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