Value > Basic Data Values > Point3 Values |
The Point3 class defines the characteristics of points in 3D space. These values are also known as vectors and contain three component floating point numbers. All the coordinates passed to and from 3ds Max are in these values. See also 2D and 3D Point Literals.
<point3>.x: Float -- the x coordinate <point3>.y: Float -- the y coordinate <point3>.z: Float -- the z coordinate
<point3> == <point3> <point3> != <point3> <point3> + <point3_or_number> <point3> - <point3_or_number> <point3> * <point3_or_number> <point3> / <point3_or_number>
Standard vector arithmetic. If the second operand is a number, the operation is performed on each component of the value.
Transforms point3 into the coordinate system specified by matrix3 .
Returns a component of the Point3 as a float. Valid range on the index is 1 to 3.
Sets a component of the Point3 to the float. Valid range on the index is 1 to 3.
Creates a new copy of the point3 value.
The new value contains a copy of the input point3 value and is independent of the input point3 value.
Returns the vector dot product.
The geometric interpretation of the dot product is the length of the projection of the first vector onto the unit vector of the second vector. Obviously, when the two vectors are perpendicular, the dot product is 0.0.
The dot product is commutative, which means that dot X Y == dot Y X.
The dot product is associative, which means that dot (r*X) Y == r*(dot X Y).
The dot product is distributive, which means that dot X (Y+Z) == (dot X Y) + (dot X Z).
Because the dot product of two normal vectors is the cosine of the angle between them, the dot product can be used conveniently to calculate the angle between two vectors:
Returns the vector cross product.
The cross product is a third vector which is always perpendicular to the plane defined by the two vectors with orientation determined by the right-hand rule.
The cross product can be expressed as the length of the first vector multiplied by the length of the second vector, multiplied by the sine of the angle between the two vectors. Because of this, the cross product of parallel vectors is 0.0 (because sin 0.0 == 0.0).
The cross product is also equal to the Area of the parallelogram formed by the two vectors. If the two vectors are edges of a face, the cross product is the normal vector to that face (a vector perpendicular to the face) with length equal to the Area of the face multiplied by 2.
The cross product is anticommutative, which means that cross X Y == cross -Y X.
The cross product is associative, which means that cross (r*X) Y == r*(cross X Y).
The cross product is distributive, which means that cross X (Y+Z) == (cross X Y) + (cross X Z).
Returns the point3 value normalized such that the vector length equals 1.
Returns the distance between the points, equivalent to the length of (point 2 - point 1).
Generates a pseudo-random point between the given points. If point A and point B are seen as the corners of a world-oriented bounding box, the random points will not reside on the vector B-A, but will fill in the volume of the bounding box.
Returns a Matrix3 value representing an arbitrary axis system using point3 as the "up" direction.
Returns a Matrix3 value with the normal specified by the given point as the Z axis. The translation portion of the Matrix3 value will be [0,0,0]. The components of the scale portion are the inverse of the values required to normalize the point3 value.
See How Do I Get the Local Rotation of a Face? for an example.
A floating point noise function over 3D space implemented by a pseudo-random tricubic spline. The return value is in the range -1.0 to +1.0. Given the same point3 value, the noise3() function always returns the same value.
The same function as noise3 in which the phase can be varied using the second parameter. The return value is in the range -1.0 to +1.0.
This is a simple fractal-loop turbulence built on top of the noise3 function. The second parameter controls the frequency of the turbulence. The return value is in the range 0.0 to +1.0.
This is a fractal function of 3D space implemented using fractional Brownian motion. The function is homogeneous and isotropic. It returns a float.
The parameters are as follows:
point3 - The point in space at which the noise is computed.
H_float - The fractal increment parameter in the range [0,1]. When H_float is 1 the function is relatively smooth; as H_float goes to 0, the function approaches white noise.
lacunarity_float - The gap between successive frequencies, best set at 2.0.
octaves_float - The number of frequencies in the function.
All the noise functions are based on code and algorithms in the book "Texturing and Modeling: A Procedural Approach", Musgrave, Peachey, Perlin and Worley. Academic Press, ISBN: 0-12-228760-6.
The following script shows the use of various literals, constructors, properties, operators, and methods of the Point3 class.
The following script was written as a test bed for the noise functions. This script displays a two dimensional slice of the noise function output as a bitmap. By changing the noise parameters in lines 4 through 10 and specifying which noise function to evaluate in line 12, you can see the effects of changes in the parameters and use of different noise functions.