# crossproduct

Just a quick question to all the mathbuffs out there…

I want to get the crossproduct of 2 vectors, and for this I set up 2

matrices going into jit.expr with the following expression :

expr "(in[1].p[2]*in[2].p[3])-(in[1].p[3]*in[2].p[2])" "(in[1].p[3]*in

[2].p[1])-(in[1].p[1]-in[2].p[3])" "(in[1].p[1]*in[2].p[2])-(in[1].p

[2]*in[1].p[3])"

I was wondering if this is correct, and maybe if there’s a much more

simple expression or object for this…?

grtz.

Brecht Debackere

http://www.autofasurer.net

M+32(0)498319302

F+32(0)70429559

Skype : Bdebackere

brecht@visualantics.net

Hi Brecht,

I’m not sure but maybe a shader can help. Parts of the shaders derivatives

are don with matrix calculations.

It’s only an idea. Maybe a bit more complicated. But matrices calculations

are much faster on gpu than on cpu.

grr.

Ranja

2007/9/27, Brecht Debackere

>

> Just a quick question to all the mathbuffs out there…

> I want to get the crossproduct of 2 vectors, and for this I set up 2

> matrices going into jit.expr with the following expression :

>

> expr "(in[1].p[2]*in[2].p[3])-(in[1].p[3]*in[2].p[2])"

> "(in[1].p[3]*in[2].p[1])-(in[1].p[1]-in[2].p[3])"

> "(in[1].p[1]*in[2].p[2])-(in[1].p[2]*in[1].p[3])"

>

> I was wondering if this is correct, and maybe if there’s a much more

> simple expression or object for this…?

>

> grtz.

> Brecht Debackere

>

> http://www.autofasurer.net

> M+32(0)498319302

> F+32(0)70429559

> Skype : Bdebackere

> brecht@visualantics.net

>

>

>

>

>

>

The idea is to create quad_strip ribbon my filling up a matrix, with

the width of the ribbon being calculated using the crossproduct using

previous positions :

vector 1 being :

current position – previous position

vector 2 :

previous position – the position before that

and then calculating the crossproduct of those 2 vectors, normalizing

it, and then some stuff with adding the current position to the

crossproduct and using that value for the even vertices of the

quad_strip. (I think it sounds clearer in my head, but it is for

doing something like this : http://www.youtube.com/watch?v=fM1qj_OFY4w )

On 27 Sep 2007, at 12:56, Ranja Achbar wrote:

> Hi Brecht,

>

> I’m not sure but maybe a shader can help. Parts of the shaders

> derivatives are don with matrix calculations.

> It’s only an idea. Maybe a bit more complicated. But matrices

> calculations are much faster on gpu than on cpu.

>

> grr.

> Ranja

>

> 2007/9/27, Brecht Debackere

> Just a quick question to all the mathbuffs out there…

>

> I want to get the crossproduct of 2 vectors, and for this I set up

> 2 matrices going into jit.expr with the following expression :

>

> expr "(in[1].p[2]*in[2].p[3])-(in[1].p[3]*in[2].p[2])" "(in[1].p[3]

> *in[2].p[1])-(in[1].p[1]-in[2].p[3])" "(in[1].p[1]*in[2].p[2])-(in

> [1].p[2]*in[1].p[3])"

>

> I was wondering if this is correct, and maybe if there’s a much

> more simple expression or object for this…?

>

> grtz.

>

> Brecht Debackere

>

> http://www.autofasurer.net

> M+32(0)498319302

> F+32(0)70429559

> Skype : Bdebackere

> brecht@visualantics.net

>

>

>

>

>

>

Brecht Debackere

http://www.autofasurer.net

M+32(0)498319302

F+32(0)70429559

Skype : Bdebackere

brecht@visualantics.net

Xray.jit.crossproduct maybe can help you.

http://www.mat.ucsb.edu/~whsmith/

wonderfull. this does exatly what I want, and normalizes as well :)

thx.

On 27 Sep 2007, at 19:50, jasmin wrote:

>

> Xray.jit.crossproduct maybe can help you.

> http://www.mat.ucsb.edu/~whsmith/

> –

> jaz

Brecht Debackere

http://www.autofasurer.net

M+32(0)498319302

F+32(0)70429559

Skype : Bdebackere

brecht@visualantics.net