thatoneguy

02-21-2009, 01:25 AM

Anybody know the equation off the top of their head for a cubic FFD transformation of a given point within the domain?

View Full Version : 8 Point FFD Equation

thatoneguy 02-21-2009, 01:25 AM Anybody know the equation off the top of their head for a cubic FFD transformation of a given point within the domain? |

thatoneguy

02-23-2009, 07:50 PM

Bump? Nobody knows the 2x2x2 ffd transform equation?

ZeBoxx2

02-23-2009, 08:25 PM

well it isn't so much an 'equation' as it is linearly transforming from one position to a new position?

I.e. in a 1D case, if you have a point on a given line (original lattice), measure the length of that line, measure the distance of the point to either end of the line. Now you stretch/compress that line (new lattice), measure the length of the line again. Divide the new length by the old length and you've got a multiplier to apply to the distance of your point to the end to get the new distance along the line - offset by the new position of the end (if changed).

Now do that for all 3 axes and you should be all set?

I.e. in a 1D case, if you have a point on a given line (original lattice), measure the length of that line, measure the distance of the point to either end of the line. Now you stretch/compress that line (new lattice), measure the length of the line again. Divide the new length by the old length and you've got a multiplier to apply to the distance of your point to the end to get the new distance along the line - offset by the new position of the end (if changed).

Now do that for all 3 axes and you should be all set?

thatoneguy

02-23-2009, 11:17 PM

In the case of 2D here is what I came up with:

y = ((p0.y+p2.y)(%y) + (p3.y+p1.y)(%y))(%x) etc etc etc..

(Find the delta Y along both sides. Find the line between them and then find the delta X along that line... that should find it. But.....

that all reduces to: (p0.y+p1.y+p2.y+p3.y)(%x)(%y)

Which works fine when %x == %y but not when %x,%y or %z are different so I must be doing it wrong. :(

y = ((p0.y+p2.y)(%y) + (p3.y+p1.y)(%y))(%x) etc etc etc..

(Find the delta Y along both sides. Find the line between them and then find the delta X along that line... that should find it. But.....

that all reduces to: (p0.y+p1.y+p2.y+p3.y)(%x)(%y)

Which works fine when %x == %y but not when %x,%y or %z are different so I must be doing it wrong. :(

reForm

02-23-2009, 11:30 PM

What are you trying to script? (if you don't mind me asking!)

thatoneguy

02-23-2009, 11:49 PM

I'm writing my own FFD transform. But for object positions instead of vertex positions.

I wrote a hack using a real FFD transform and an editable mesh. But it's reallllllly crashy.

I wrote a hack using a real FFD transform and an editable mesh. But it's reallllllly crashy.

thatoneguy

02-23-2009, 11:56 PM

Ha! Stupid *slaps self with trout*

No wonder it didn't make any sense. My equation for "0.x along line between two points" equation was COMPLETELY wrong.

I was just taking the old midpoint equation:

(x1 + x2)*.5

(y1 + y2)*.5

and trying to replace .5 with my own float. that won't work!

No wonder it didn't make any sense. My equation for "0.x along line between two points" equation was COMPLETELY wrong.

I was just taking the old midpoint equation:

(x1 + x2)*.5

(y1 + y2)*.5

and trying to replace .5 with my own float. that won't work!

ZeBoxx2

02-24-2009, 01:04 AM

trout abuse!

justified, though... keep slapping :)

justified, though... keep slapping :)

eek

02-24-2009, 03:05 AM

Essentially all you need to do is get the weight of the object realtive to the points its near. So you could do this, get object 'a' get the lengths from it to all the other points, and normalize it in this space. eg.

A to B = 10 , A to C = 20 , A to D = 30 , total = 60,

now you need to get the inverse weight space to them, i do this by simple division:

60/10 = 6, 60/20 = 3, 60/30 = 2, total = 11

now i do standard division to get the multiplier each point onto A:

6/11 = .54 , 3/11 = .27 , 2/11 = .18

So A.pos = (B.pos * .54) + (C.pos * .27) + (D.pos * .18)

Here's the basic formula, i encapsulated a lot of summations, but this could just be several loops.

Equation (http://latex.codecogs.com/png.latex?\bg_white&space;\200dpi&space;\sum_{i}^{n}&space;v_{i}&space;w_{i}\\&space;Where\&space;w_{i}&space;=\left(\frac{\frac{\sum_{i}^{n}&space;|p-v_{i}|&space;}{|p-v_{i}|}}{\sum_{i}^{n}&space;\left(\frac{\sum_{i}^{n}&space;|p-v_{i}|&space;}{|p-v_{i}|}&space;\right)}\right))

where n is the number or points, v(i) is your point position and p is the objects position, and w(i) is the weight. The weights would have to be stored into an array.

A to B = 10 , A to C = 20 , A to D = 30 , total = 60,

now you need to get the inverse weight space to them, i do this by simple division:

60/10 = 6, 60/20 = 3, 60/30 = 2, total = 11

now i do standard division to get the multiplier each point onto A:

6/11 = .54 , 3/11 = .27 , 2/11 = .18

So A.pos = (B.pos * .54) + (C.pos * .27) + (D.pos * .18)

Here's the basic formula, i encapsulated a lot of summations, but this could just be several loops.

Equation (http://latex.codecogs.com/png.latex?\bg_white&space;\200dpi&space;\sum_{i}^{n}&space;v_{i}&space;w_{i}\\&space;Where\&space;w_{i}&space;=\left(\frac{\frac{\sum_{i}^{n}&space;|p-v_{i}|&space;}{|p-v_{i}|}}{\sum_{i}^{n}&space;\left(\frac{\sum_{i}^{n}&space;|p-v_{i}|&space;}{|p-v_{i}|}&space;\right)}\right))

where n is the number or points, v(i) is your point position and p is the objects position, and w(i) is the weight. The weights would have to be stored into an array.

thatoneguy

02-24-2009, 06:36 PM

Hmmm normalized weighting... that's nice and elegant.

I took the brute force approach. :D

deltaXYZ = [0.5,0.5,0.5]

centerpoint = ((((((p0.pos)*(1-deltaXYZ.Z)+(p2.pos)*(deltaXYZ.Z))*(1-deltaXYZ.X)) + (((p1.pos)*(1-deltaXYZ.Z)+(p3.pos)*(deltaXYZ.Z))*(deltaXYZ.X)))*(1-deltaXYZ.Y)) + (((((p4.pos)*(1-deltaXYZ.Z)+(p6.pos)*(deltaXYZ.Z))*(1-deltaXYZ.X)) + (((p5.pos)*(1-deltaXYZ.Z)+(p7.pos)*(deltaXYZ.Z))*(deltaXYZ.X)))*(deltaXYZ.Y)))

point pos:centerpoint

I took the brute force approach. :D

deltaXYZ = [0.5,0.5,0.5]

centerpoint = ((((((p0.pos)*(1-deltaXYZ.Z)+(p2.pos)*(deltaXYZ.Z))*(1-deltaXYZ.X)) + (((p1.pos)*(1-deltaXYZ.Z)+(p3.pos)*(deltaXYZ.Z))*(deltaXYZ.X)))*(1-deltaXYZ.Y)) + (((((p4.pos)*(1-deltaXYZ.Z)+(p6.pos)*(deltaXYZ.Z))*(1-deltaXYZ.X)) + (((p5.pos)*(1-deltaXYZ.Z)+(p7.pos)*(deltaXYZ.Z))*(deltaXYZ.X)))*(deltaXYZ.Y)))

point pos:centerpoint

CGTalk Moderation

02-24-2009, 06:36 PM

This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.