Torabi Architect.
Mathsurf Documents Apr 2009
arrowSpherical Point.
 

Transforming point p from its Cartesian coordinate system to spherical coordinate system will produce the new vector called spherical point .Mathsurf provides a shortcut to obtain the spherical coordinates of 3d points in 3ds Max. The spherical class also allows you to apply the transformation on spherical points.
Syntax: Spherical rad:radius  theta: azimuth  phi: longitude

 

   

arrowProperties:

<Spherical>.rad
Returns the distance of the point from the origin (radius of the spherical point)


<Spherical>.theta
 Returns the angle between the plane contains the point p and axe z and xz plane. (Azimuth of the spherical point)


<Spherical>.theta
 Returns the angle between xy plane and vector p. (longitude of the spherical point)

arrowMethods:

<Spherical>.X() , Y() , Z()
 Return the Cartesian coordinate components of the spherical point.


<Spherical>.getVector()
 Returns a point3 representing the current point in Cartesian coordinate system.

arrowOperators:

<Spherical>.add value
Returns new spherical point by adding the argument to the current point. If the argument is spherical point the result would be a translation of two vectors otherwise the add function will effect only on radius.
Example:
a = spherical 2.0 30.0 90.0 , b = spherical 5.0 10.0 -20.0
a.add b returns  spherical 7.0 40.0 70.0
a.add  12 returns  spherical 14.0 30.0 90.0


<Spherical>.sub value
Returns new spherical point by subtracting the value from the current point. If the argument is spherical point the result would be a translation of the current vector and the reveres vector otherwise the sub function will effect only on radius.
Example:
a = spherical 2.0 30.0 90.0 , b = spherical 5.0 10.0 -20.0
a.sub b returns  spherical -3.0 20.0 110.0
a.sub  -2 returns  spherical 4.0 30.0 90.0

<Spherical>.times value
Returns new spherical point includes production of corresponding components of two points. If the operator is scalar value the new result would be scaled vector in same orientation as the current point.
Example:
a = spherical 2.0 30.0 90.0 , b = spherical 5.0 10.0 -20.0
a.times b returns  spherical 10.0 300.0 -1800.0
a.times  3 returns  spherical 6.0 30.0 90.0


<Spherical>.div  value
Returns new spherical point includes division of corresponding components of two points. If the operator is scalar value the new result would be scaled vector in same orientation as the current point.
Example:
a = spherical 2.0 30.0 90.0 , b = spherical 5.0 10.0 -20.0
a.div b returns  spherical 0.4 3.0 -4.5
a.div  2.0 returns  spherical 1.0 30.0 90.0


<Spherical>.addVector point3
This function performs translation of the current point and the point3 value in Cartesian coordinate and returns the result in spherical format.
Example:
a = spherical 5.0 30.0 90.0
a.addvector [-2,0,10] returns  (spherical rad:15.1327 theta:180.0 phi:82.4054)

 

arrowMore functions:


<Spherical>.unitvector index
This function return unit vector for the spherical point in point3 format. The unit vector consist of three directions that the point has along the radius, theta and phi component in Cartesian coordinate. The index value determines the normal vector should be retrieved from spherical point.
Index 1: will return the normal vector along the radius vector.
Index 2: will return the normal vector tangent to the local sphere of the point parallel to xy plane.
Index 3: will return the normal vector tangent to local sphere of the point and along the phi direction.
Example:
a = spherical 5.0 30.0 90.0
a.unitvector 1 returns [0.866025,0.5,0]
a.unitvector 2 returns [-0.5,0.866025,0]
a.unitvector 3 returns [0,0,-0.5]


<Spherical>.getRotationMatrix angle
This function returns a matrix representing the transformation that needs to be applied on any point in 3d space to rotate in amount of angle around the local vector that connect the point p to the origin.
Example:
a.getRotationMatrix 30.0 returns (matrix3 [0.866025,0.5,0] [-0.5,0.866025,0] [0,0,1] [0,0,0])

The function getSpherical() can transfer a point3 value to spherical coordinate  system.See Mathsurf functions.

 

 

 

 
arrowMathsurf Classes.
arrowAdditional Functions.
arrowBack to Index
 
www.torabiarchitect.com