API functions that utilize the vec3d class are grouped here. For details of the class, including member functions, see vec3d. Click here to return to the main page.
More...
|
vec3d | operator+ (const vec3d &a, const vec3d &b) |
|
vec3d | operator- (const vec3d &a, const vec3d &b) |
|
vec3d | operator* (const vec3d &a, double b) |
|
vec3d | operator* (const vec3d &a, const vec3d &b) |
|
vec3d | operator/ (const vec3d &a, double b) |
|
double | dist (const vec3d &a, const vec3d &b) |
|
double | dist_squared (const vec3d &a, const vec3d &b) |
|
double | dot (const vec3d &a, const vec3d &b) |
|
vec3d | cross (const vec3d &a, const vec3d &b) |
|
double | angle (const vec3d &a, const vec3d &b) |
|
double | signed_angle (const vec3d &a, const vec3d &b, const vec3d &ref) |
|
double | cos_angle (const vec3d &a, const vec3d &b) |
|
vec3d | RotateArbAxis (const vec3d &p, double theta, const vec3d &r) |
|
◆ angle()
Calculate the angle between two vec3d inputs (dot product divided by their magnitudes multiplied)
float PI = 3.14159265359;
a.set_xyz( 1.0, 1.0, 0.0 );
b.set_xyz( 1.0, 0.0, 0.0 );
if ( abs(
angle( a, b ) - PI / 4 ) > 1e-6 ) { Print(
"---> Error: Vec3d Angle " ); }
double angle(const vec3d &a, const vec3d &b)
- Parameters
-
- Returns
- Angle in Radians
◆ cos_angle()
double cos_angle |
( |
const vec3d & | a, |
|
|
const vec3d & | b ) |
Calculate the cosine of angle between two vec3d inputs
vec3d line_pt1(), line_pt2();
line_pt1.set_z( 4 );
line_pt2.set_y( 3 );
vec3d p_ln1 = pnt - line_pt1;
vec3d ln2_ln1 = line_pt2 - line_pt1;
double cos_angle(const vec3d &a, const vec3d &b)
- See also
- angle
- Parameters
-
- Returns
- Angle in Radians
◆ cross()
Calculate the cross product between two vec3d inputs
a.set_xyz( 4.0, 0.0, 0.0 );
b.set_xyz( 0.0, 3.0, 0.0 );
c.normalize();
vec3d cross(const vec3d &a, const vec3d &b)
- Parameters
-
- Returns
- Cross product
◆ dist()
Calculate the distance between two vec3d inputs
a.set_xyz( 2.0, 2.0, 2.0 );
b.set_xyz( 3.0, 4.0, 5.0 );
if ( abs( d - sqrt( 14 ) ) > 1e-6 ) { Print( "---> Error: Vec3d Dist " ); }
double dist(const vec3d &a, const vec3d &b)
- See also
- dist_squared
- Parameters
-
- Returns
- Distance
◆ dist_squared()
double dist_squared |
( |
const vec3d & | a, |
|
|
const vec3d & | b ) |
Calculate distance squared between two vec3d inputs
a.set_xyz( 2.0, 2.0, 2.0 );
b.set_xyz( 3.0, 4.0, 5.0 );
if ( abs( d2 - 14 ) > 1e-6 ) { Print( "---> Error: Vec3d Dist " ); }
double dist_squared(const vec3d &a, const vec3d &b)
- See also
- dist
- Parameters
-
- Returns
- Distance squared
◆ dot()
Calculate the dot product between two vec3d inputs
a.set_xyz( 1.0, 2.0, 3.0 );
b.set_xyz( 2.0, 3.0, 4.0 );
if ( abs(
dot( a, b ) - 20 ) > 1e-6 ) { Print(
"---> Error: Vec3d Dot " ); }
double dot(const vec3d &a, const vec3d &b)
- Parameters
-
- Returns
- Dot product
◆ operator*() [1/2]
Scalar multiplication operator for a vec3d, performed by the multiplication of each vec3d component and the scalar
a.set_xyz( 1.0, 2.0, 3.0 );
double b = 1.5;
Print( "a * b = ", false );
Print( c );
◆ operator*() [2/2]
Scalar multiplication operator for a vec3d, performed by the multiplication of each vec3d component and the scalar
a.set_xyz( 1.0, 2.0, 3.0 );
double b = 1.5;
Print( "a * b = ", false );
Print( c );
◆ operator+()
Addition operator for two vec3d objects, performed by the addition of each corresponding component
a.set_xyz( 1.0, 2.0, 3.0 );
b.set_xyz( 4.0, 5.0, 6.0 );
Print( "a + b = ", false );
Print( c );
◆ operator-()
Subtraction operator for two vec3d objects, performed by the subtraction of each corresponding component
\forcpponly
\code{.cpp}
a.set_xyz( 1.0, 2.0, 3.0 );
b.set_xyz( 4.0, 5.0, 6.0 );
Print( "a - b = ", false );
Print( c );
◆ operator/()
Scalar division operator for a vec3d, performed by the division of of each vec3d component by the scalar
a.set_xyz( 1.0, 2.0, 3.0 );
double b = 1.5;
Print( "a / b = ", false );
Print( c );
◆ RotateArbAxis()
Rotate a input point by specified angle around an arbitrary axis. Assume right hand coordinate system
float PI = 3.14;
a.set_xyz( 1.0, 1.0, 0.0 );
b.set_xyz( 1.0, 0.0, 0.0 );
c.set_xyz( 0.0, 0.0, 1.0 );
vec3d RotateArbAxis(const vec3d &p, double theta, const vec3d &r)
- Parameters
-
[in] | p | Coordinate point to rotate |
[in] | theta | Angle of rotation in Radians |
[in] | axis | Reference axis for rotation |
- Returns
- Coordinates of rotated point
◆ signed_angle()
double signed_angle |
( |
const vec3d & | a, |
|
|
const vec3d & | b, |
|
|
const vec3d & | ref ) |
Calculate the signed angle between two vec3d inputs (dot product divided by their magnitudes multiplied) and an input reference axis
float PI = 3.14159265359;
a.set_xyz( 1.0, 1.0, 0.0 );
b.set_xyz( 1.0, 0.0, 0.0 );
c.set_xyz( 0.0, 0.0, 1.0 );
if ( abs(
signed_angle( a, b, c ) - -PI / 4 ) > 1e-6 ) { Print(
"---> Error: Vec3d SignedAngle " ); }
double signed_angle(const vec3d &a, const vec3d &b, const vec3d &ref)
- Parameters
-
[in] | a | First vec3d |
[in] | b | Second vec3d |
[in] | ref | Reference axis |
- Returns
- Angle in Radians