|
My math skills are not the strongest, and I am having a problem figuring out how to solve a scenario in MAXScript.
I am trying to get the Unit Vector (and other values) of vertices from the point of view of vertices in another mesh.
The situation is that there is a plane converted to Editable Poly. There is then another plane copied from that plane--so they have the same vertex count/order. The original is kept for reference and the second is used to sculpt (in this case a landscape).
I need to then retrieve various bits of information from the vertices… for example, the unit vector of vertices D1, D2, D3, etc, as well as their distances from S1, S2, S3, etc.
My understanding is weak… the values I’m getting are far far from what I expect… and I’m assuming it’s because my understanding is far far from accurate.
Here is an example snippet that generates info that is not what I want:
(d and s are both editable poly)
for i = 1 to (polyop.getNumVerts d) do (
vd = polyop.getVert d i
vs = polyop.getVert s i
dist = distance vs vd
unitVector = vd/dist
print ("Vertex #"+(i as string)+" "+((dist) as string) +" Unit Vector: "+(unitVector as string))
)
The output is continuously things like:
"Vertex #20 0.0 Unit Vector: [-1.#INF,1.#INF,-1.#INF]"
"Vertex #21 5.10022 Unit Vector: [-496.488,234.999,-314.324]" etc
But I (think) am looking for things like:
"Vertex #20 0.0 Unit Vector: [0,0,1]"
"Vertex #21 5.10022 Unit Vector: [0.5,0.25,0.25]" etc
Attached is a screen shot example of some source to taget vertices I am trying to get data from.
Hopefully this makes sense. I am not the world’s greatest mathmatician… (came from a background in journalism)… so I’m playing catchup with some of these concepts.
Much thanks in advance for any help.
______________________________
Shawn Olson’s Creative Arts
Developer of the Wall Worm Model Tools for Source
And my Favorite Unsung Plugin: Convexity for Level Design
Max 4/Gmax, 2008 - 2013
Mudbox 2009-2011
Win 7 x64 (x4)
Geforce 480x2 | Geforce 275x1 | ATI Radeon HD 3200 | Intel Generic chip
8GB | 12GB | 4GB | 4GB
Intel Quad 6700 | i7 930 | Athlon QL-65 | Intel Quad 6700
| Attachment
|
|
|