RE: [script] Normals - not understanding

Date : Thu, 19 Oct 2006 15:00:42 +0100
To : <XSI(at)Softimage.COM>
From : "Kim Aldis" <XSI(at)kim-aldis.co.uk>
Subject : RE: [script] Normals - not understanding
Vectors you can rotate just as you would any other point but scales and
transforms are different. A transform changes the direction and length of
the vector and a scale just changes it's length. The thing to remember about
vectors is that they're just directions, nothing more. Although conceptually
you think of them as having position when associated with a vertex, they
have no position at all. It's important you try and get your head around
that basic concept.



> -----Original Message-----
> From: owner-xsi(at)Softimage.COM [mailto:owner-xsi(at)Softimage.COM] On
> Behalf Of Bernard Lebel
> Sent: 19 October 2006 14:29
> To: XSI(at)Softimage.COM
> Subject: Re: [script] Normals - not understanding
> 
> Hi Aloys,
> 
> I was not using the same operation!
> 
> Anyway I thought that simply getting the normal orientation in object
> space, then to world space, would be enough for rotating nulls.
> 
> 
> 
> Mathieu: thanks a lot for the explanation. If that made sense,
> well...... I got to do my homeworks. Once again :-(
> 
> 
> Bernard
> 
> 
> On 10/18/06, Aloys Baillet <aloys.baillet(at)gmail.com> wrote:
> > Hi Bernard,
> >
> > Normals are not points, they are vectors. You can't transform them
> > from object to world space using the same operations as for point
> positions.
> > You can read there for more info:
> >  http://www.unknownroad.com/rtfm/graphics/rt_normals.html
> >
> > Cheers,
> >
> > Aloys
> >
> >
> > On 10/19/06, Mathieu Leclaire < mleclair(at)hybride.com> wrote:
> > > Of course... cross products... the cross product of 2 vectors will
> > > give
> > you
> > > the perpendicular vector. 2 vectors will form a plane unless they
> > > are both aligned (pointing in the same direction or in exact
> opposite directions).
> > So
> > > doing the cross product will give you the normal of that plane. So
> I
> > assign
> > > vY towards the global Y axis and I do the cross product of it with
> > > the normal vector giving me the correct vX vector. Then I do the
> > > cross product of that vX vector with the vZ (the normal) to get the
> > > correct vY. So basically, vY(0,1,0) acts like an up vector. vZ will
> > > point towards the normal and vY will be aligned with the up-vector.
> > > Normalize them and place them in the Rotation from axis and there
> > > you go. Does that make sense to you?
> > >
> > > Mathieu
> > >
> > > -----Original Message-----
> > > From: owner-xsi(at)Softimage.COM [mailto:owner-xsi(at)Softimage.COM]On
> > > Behalf Of Bernard Lebel
> > > Sent: Wednesday, October 18, 2006 3:53 PM
> > > To: XSI(at)Softimage.COM
> > > Subject: Re: [script] Normals - not understanding
> > >
> > >
> > > Nope, you are spot on Mathieu. That's exactly what I was trying to
> do.
> > >
> > > In hopes of understanding this more......
> > >
> > >
> > > Do you mind explaining why you did this?
> > >
> > > vZ = ovGlobalNormal;
> > > vY.Set(0, 1, 0);
> > > vX.Cross(vY, vZ);
> > > vY.Cross(vZ, vX);
> > >
> > >
> > > Thanks
> > > Bernard
> > >
> > >
> > > On 10/18/06, Mathieu Leclaire <mleclair(at)hybride.com> wrote:
> > > > I'm sorry... I'm not sure I understand what you are looking
> for...
> > > > did I anwser your question on my last reply or did I miss the
> point?
> > > >
> > > > -----Original Message-----
> > > > From: owner-xsi(at)Softimage.COM [mailto:owner-xsi(at)Softimage.COM]On
> > > > Behalf Of Bernard Lebel
> > > > Sent: Wednesday, October 18, 2006 3:11 PM
> > > > To: XSI(at)Softimage.COM
> > > > Subject: Re: [script] Normals - not understanding
> > > >
> > > >
> > > > I should add that the actual null rotation values correspond to
> > > > the normal values. However, the normal values are, from what I
> > > > see, very strange. For instance, to match a normal of a certain
> > > > vertex of values 40.0, 0.0, 40.0, I would have to use a rotation
> value of 0.0, 45.0, 0.
> > > >
> > > >
> > > > Bernard
> > > >
> > > >
> > > >
> > > > On 10/18/06, Bernard Lebel <3dbernard(at)gmail.com> wrote:
> > > > > Hi,
> > > > >
> > > > > I'm writing a script that extracts the normal vector of every
> > > > > point of a mesh. Then these vectors are mapped to world space.
> > > > > Finally, for each point, a null is created and the world vector
> > > > > is applied to its rotation.
> > > > >
> > > > > For a minority of normals, it works well, the null ends up with
> > > > > the right orientation. But for a majority of them, the null has
> > > > > an orientation that I have a hard time to figure out.
> > > > >
> > > > > If you create a sphere and run the code below, you'll see what
> I mean:
> > > > >
> > > > >
> > > > > import win32com
> > > > >
> > > > > xsi = Application
> > > > > xsimath = win32com.client.Dispatch( 'XSI.Math' )
> > > > >
> > > > > oMesh = xsi.selection(0)
> > > > > oMeshTransform = oMesh.kinematics.local.transform
> > > > >
> > > > > for oPoint in oMesh.activeprimitive.geometry.points:
> > > > >
> > > > >         # Get global point normal direction
> > > > >         ovGlobalNormal =
> > xsimath.mapobjectorientationtoworldspace (
> > > > > oMeshTransform, oPoint.normal )
> > > > >
> > > > >         # Get New point position
> > > > >         ovGlobalPosition =
> > xsimath.mapobjectpositiontoworldspace(
> > > > > oMeshTransform, oPoint.position )
> > > > >
> > > > >         # create null
> > > > >         oNull = xsi.activesceneroot.addnull()
> > > > >
> > > > >         oNull.kinematics.local.rotx.value =
> > xsimath.radianstodegrees(
> > > > > ovGlobalNormal.x )
> > > > >         oNull.kinematics.local.roty.value =
> > xsimath.radianstodegrees(
> > > > > ovGlobalNormal.y )
> > > > >         oNull.kinematics.local.rotz.value =
> > xsimath.radianstodegrees(
> > > > > ovGlobalNormal.z )
> > > > >
> > > > >         oNull.kinematics.local.posx.value =
> > ovGlobalPosition.x
> > > > >         oNull.kinematics.local.posy.value =
> > ovGlobalPosition.y
> > > > >         oNull.kinematics.local.posz.value =
> > ovGlobalPosition.z
> > > > >
> > > > >
> > > > >
> > > > > Any idea?
> > > > >
> > > > >
> > > > > Using XSI 5.11
> > > > >
> > > > >
> > > > > Thanks
> > > > > Bernard
> > > > >
> > > > ---
> > > > Unsubscribe? Mail Majordomo(at)Softimage.COM with the following text
> > > > in
> > body:
> > > > unsubscribe xsi
> > > >
> > > >
> > > >
> > > > ---
> > > > Unsubscribe? Mail Majordomo(at)Softimage.COM with the following text
> > > > in
> > body:
> > > > unsubscribe xsi
> > > >
> > > ---
> > > Unsubscribe? Mail Majordomo(at)Softimage.COM with the following text
> in body:
> > > unsubscribe xsi
> > >
> > >
> > >
> > > ---
> > > Unsubscribe? Mail Majordomo(at)Softimage.COM with the following text
> in body:
> > > unsubscribe xsi
> > >
> >
> >
> >
> > --
> > Aloys Baillet - XSI Technical Director Character Dpt - Animal Logic
> > --
> ---
> Unsubscribe? Mail Majordomo(at)Softimage.COM with the following text in
> body:
> unsubscribe xsi

---
Unsubscribe? Mail Majordomo(at)Softimage.COM with the following text in body:
unsubscribe xsi


Search the XSI List archives here or use the advanced search form to search across mailing lists. Searching help is available.
This site supposedly brought to you by Benjamin Grosser and the Imaging Technology Group.