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...
|
double | dist (const vec3d &in a, const vec3d &in b) |
|
double | dist_squared (const vec3d &in a, const vec3d &in b) |
|
double | dot (const vec3d &in a, const vec3d &in b) |
|
vec3d | cross (const vec3d &in a, const vec3d &in b) |
|
double | angle (const vec3d &in a, const vec3d &in b) |
|
double | signed_angle (const vec3d &in a, const vec3d &in b, const vec3d &in ref) |
|
double | cos_angle (const vec3d &in a, const vec3d &in b) |
|
vec3d | RotateArbAxis (const vec3d &in p, double theta, const vec3d &in axis) |
|
◆ angle()
double angle |
( |
const vec3d &in |
a, |
|
|
const vec3d &in |
b |
|
) |
| |
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 " ); }
- Parameters
-
- Returns
- Angle in Radians
◆ cos_angle()
double cos_angle |
( |
const vec3d &in |
a, |
|
|
const vec3d &in |
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;
- 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();
- Parameters
-
- Returns
- Cross product
◆ dist()
double dist |
( |
const vec3d &in |
a, |
|
|
const vec3d &in |
b |
|
) |
| |
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 " ); }
- See also
- dist_squared
- Parameters
-
- Returns
- Distance
◆ dist_squared()
double dist_squared |
( |
const vec3d &in |
a, |
|
|
const vec3d &in |
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 " ); }
- See also
- dist
- Parameters
-
- Returns
- Distance squared
◆ dot()
double dot |
( |
const vec3d &in |
a, |
|
|
const vec3d &in |
b |
|
) |
| |
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 " ); }
- Parameters
-
- Returns
- Dot product
◆ RotateArbAxis()
vec3d RotateArbAxis |
( |
const vec3d &in |
p, |
|
|
double |
theta, |
|
|
const vec3d &in |
axis |
|
) |
| |
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 );
- 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 &in |
a, |
|
|
const vec3d &in |
b, |
|
|
const vec3d &in |
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 " ); }
- Parameters
-
[in] | a | First vec3d |
[in] | b | Second vec3d |
[in] | ref | Reference axis |
- Returns
- Angle in Radians