» CGS Wiki Navigation
» Search
» Toolbox
Geometric Calculations (3dsmax)
Contents |
[edit]
Vectors
[edit]
Normalization
A normalized vector has a length of exactly 1.0, this value can be multiplied to get exact lengths. ie. A normalized vector multiplied by 5.617 will give you a vector with the length 5.617.
Code:
normalize vec
[edit]
Cross Product
Gives you the vector perpendicular to the two vectors supplied.
Code:
cross vec1 vec2
[edit]
Dot Product
Gives you a relationship between two vectors.
Code:
dot vec1 vec2
Gives you the cosine of the angle between two normalized vectors.
Code:
dot (normalize vec1) (normalize vec2)
The result returned by a dot product passed, when acos'd will return the angle in degrees between the two vectors.
Code:
acos (dot (normalize vec1) (normalize vec2))
[edit]
Line
A line can be defined by:
- 2 points
- a point of origin and an offset vector
- a point of origin, a normalized vector and a scalar length
[edit]
Mid-Point
The exact center between two points.
Code:
fn midPoint pt1 pt1 = ((pt1+pt2)/2.0)
[edit]
Linear Interpolation (LERP)
Code:
fn lerp pt1 pt2 alpha = (pt1+((pt2-pt1)*alpha))
[edit]
Plane
A plane can be defined by
- 3 non-colinear points
- a point and 2 vectors
- a point and a normalized vector (the normal vector)
[edit]
Distance Between a Point and a Plane
[edit]
Plane (vector/point)
- vec = plane vector
- ppt = a point on the plane
- pt = point you want to test
Code:
fn PointToPlaneDist vec ppt pt =
(vec.x*pt.x+vec.y*pt.y+vec.z*pt.z) - (vec.x*ppt.x+vec.y*ppt.y+vec.z*ppt.z)
[edit]
Acknowledgements
Article inspired by the Geometrical Calculations post on CGTalk
- This page was last modified 12:33, 3 November 2006.
- This page has been accessed 1,650 times.
- Content is available under GNU Free Documentation License.
- About CGWiki
- Disclaimers

