Message 1 of 2
FFD Control Point to World Space and Back Again

Not applicable
11-30-2011
09:14 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I'm trying to convert FFD points from their custom space to world space and back again, but There is some error in the converting back portion. For some reason 0.83333 gets added to the coordinates. e.g. On control_point_1 it goes from ->
"Orig: "
"Point 1: "
"Final: "
The actual position of my object in world space doesn't matter, it always adds 0.83333 to the coordinate. Can anyone see what I'm doing wrong?
"Orig: "
"Point 1: "
"Final: "
The actual position of my object in world space doesn't matter, it always adds 0.83333 to the coordinate. Can anyone see what I'm doing wrong?
fn GetRealWorldCoords obj ffd ffdPoint =
(
print ("Orig: " + ffdPoint as string)
objTM = obj.objectTransform
modTM = (getModContextTM obj ffd) * ffd.lattice_transform.value
modBBMin = getModContextBBoxMin obj ffd
modBBMax = getModContextBBoxMax obj ffd
point1PosWorld = modBBMin + (ffdPoint * (modBBMax - modBBMin)) * (inverse modTM) * objTM
return point1PosWorld
)
fn GetFFDCoords obj ffd worldPoint =
(
objTM = obj.objectTransform
modTM = (getModContextTM obj ffd) * ffd.lattice_transform.value
modBBMin = getModContextBBoxMin obj ffd
modBBMax = getModContextBBoxMax obj ffd
controlPointPos = (worldPoint - modBBMin) * (inverse objTM) / (modBBMax - modBBMin)
print ("Final: " + controlPointPos as string)
)