prependicular vector

Oct 14, 2006 at 11:37pm

prependicular vector

hi list, looking to create a vector that will always stay perpendicular to a
specified unit vector. search led me to cross products but as this is a
special case (crossproduct is a product of 2 vector and here the cross of a
vec and its perpendicular brother equals zero) the math is beyond me at this
point. i messed around with a low dim xray.jit.crossproduct but didnt get
far.
any help will be

#28149
Oct 15, 2006 at 12:05am

Well, any vector defines a plane, and within a plane there are an
infinite number of lines/vectors. So, the answer to your question is
that there are an infinite number of perpendicalr vectors to your unit
vector. Now the question is, which one of those will be most useful
to you. Are there any other constraints? If not, then you can treat
the problem in the 2D case such that if you have vector (x, y, z) then
(-y, x, z) will be perpendicular to it.

wes

On 10/14/06, yair reshef wrote:
>
> hi list, looking to create a vector that will always stay perpendicular to a
> specified unit vector. search led me to cross products but as this is a
> special case (crossproduct is a product of 2 vector and here the cross of a
> vec and its perpendicular brother equals zero) the math is beyond me at this
> point. i messed around with a low dim xray.jit.crossproduct but didnt get
> far.
> any help will be
>
>
>
>

#86127
Oct 15, 2006 at 12:46am

thnx wesly, that is something neglected to mention, i work with sketch in
2d.
so simple…

2006/10/15, Wesley Smith :
>
> Well, any vector defines a plane, and within a plane there are an
> infinite number of lines/vectors. So, the answer to your question is
> that there are an infinite number of perpendicalr vectors to your unit
> vector. Now the question is, which one of those will be most useful
> to you. Are there any other constraints? If not, then you can treat
> the problem in the 2D case such that if you have vector (x, y, z) then
> (-y, x, z) will be perpendicular to it.
>
> wes
>
> On 10/14/06, yair reshef wrote:
> >
> > hi list, looking to create a vector that will always stay perpendicular
> to a
> > specified unit vector. search led me to cross products but as this is a
> > special case (crossproduct is a product of 2 vector and here the cross
> of a
> > vec and its perpendicular brother equals zero) the math is beyond me at
> this
> > point. i messed around with a low dim xray.jit.crossproduct but didnt
> get
> > far.
> > any help will be
> >
> >
> >
> >
>

#86128
Oct 15, 2006 at 12:54am

ok, in 2d the perpendicar of (x, y) is (-y, x) or (y, -x).

wes

On 10/14/06, yair reshef wrote:
>
> thnx wesly, that is something neglected to mention, i work with sketch in
> 2d.
> so simple…
>
>
> 2006/10/15, Wesley Smith < wesley.hoke@gmail.com>:
> > Well, any vector defines a plane, and within a plane there are an
> > infinite number of lines/vectors. So, the answer to your question is
> > that there are an infinite number of perpendicalr vectors to your unit
> > vector. Now the question is, which one of those will be most useful
> > to you. Are there any other constraints? If not, then you can treat
> > the problem in the 2D case such that if you have vector (x, y, z) then
> > (-y, x, z) will be perpendicular to it.
> >
> > wes
> >
> > On 10/14/06, yair reshef < yair99@gmail.com> wrote:
> > >
> > > hi list, looking to create a vector that will always stay perpendicular
> to a
> > > specified unit vector. search led me to cross products but as this is a
> > > special case (crossproduct is a product of 2 vector and here the cross
> of a
> > > vec and its perpendicular brother equals zero) the math is beyond me at
> this
> > > point. i messed around with a low dim xray.jit.crossproduct but didnt
> get
> > > far.
> > > any help will be
> > >
> > >
> > >
> > >
> >
>
>
>
>
>

#86129
Oct 16, 2006 at 11:57am

hello

i built a-perp, which calculates the perpendicular vectors

here’s the main loop it executes

void perp_calc (perp *x)
{

/*

P – 1/||q||^2 * [1x3]matrix

*/
short i;
float qx2, qxqy, qyqz, qxqz,
qy2,
qz2,
px, py, pz,
qx, qy, qz,
normq;
float temp[3];
t_atom *o;

o = x->perp;

qx = x->q[0];
qy = x->q[1];
qz = x->q[2];
px = x->p[0];
py = x->p[1];
pz = x->p[2];

qx2=qx*qx;
qy2=qy*qy;
qz2=qz*qz;
qxqy=qx*qy;
qyqz=qy*qz;
qxqz=qx*qz;

// 1/||q||^2
normq= (sqrt(qx*qx+qy*qy*qz*qz));
normq= normq*normq;
if (normq==0.) {
;
} else {
normq= 1./normq;
}

// matrix calcs projection
temp[0] = qx2*px + qxqy*py + qxqz*pz;
temp[1] = qxqy*px + qy2*py + qyqz*pz;
temp[2] = qxqz*px + qyqz*py + qz2*pz;

temp[0] = temp[0] * normq;
temp[1] = temp[1] * normq;
temp[2] = temp[2] * normq;

// p – projqP
sub(temp, x->p, temp);

for(i=0;i<3;i++) {
SETFLOAT(o+i, temp[i]);
}
outlet_list(x->c_out, 0L, 3, o);

}

this is a part of my a-objects, still in beta 7 i believe
http://www.s373.net/code
cheers

a
On 2006, Oct, 15 , at 12:37 , yair reshef wrote:

> hi list, looking to create a vector that will always stay
> perpendicular to a specified unit vector. search led me to cross
> products but as this is a special case (crossproduct is a product
> of 2 vector and here the cross of a vec and its perpendicular
> brother equals zero) the math is beyond me at this point. i messed
> around with a low dim xray.jit.crossproduct but didnt get far.
> any help will be

#86130
Oct 16, 2006 at 11:59am

#86131

You must be logged in to reply to this topic.