Documentation ¶
Overview ¶
Package vect3d implements several 3d vector functions.
Index ¶
- func Add(a, b [3]float64) (result [3]float64)
- func CrossProduct(a, b [3]float64) (result [3]float64)
- func DistPt2Line(a, n, b [3]float64) float64
- func DistPt2Pt(a, b [3]float64) float64
- func DotProduct(veca, vecb [3]float64) float64
- func GetAngle(a, b [3]float64) float64
- func GetComplexRotationMatrix(xAngle, yAngle, zAngle float64) (Q [][]float64)
- func GetRotationMatrix(axis [3]float64, angle float64) (Q [][]float64)
- func GetSignedAngle(a, b, axis [3]float64) float64
- func Magnitude(vec [3]float64) float64
- func Make2D(r, c int) (A [][]float64)
- func Make3D(r, c, d int) (A [][][]float64)
- func NearestPtOnLine(a, n, b [3]float64) [3]float64
- func Normalize(a [3]float64) [3]float64
- func ReflectX(a [3]float64) (b [3]float64)
- func ReflectY(a [3]float64) (b [3]float64)
- func ReflectZ(a [3]float64) (b [3]float64)
- func Rotate3D(A [3][3]float64, b [3]float64) (c [3]float64)
- func RotateAxis(a, origin, axis [3]float64, angle float64) (b [3]float64)
- func RotateN1N2(a, origin, n1, n2 [3]float64, angle float64) (b [3]float64)
- func RotateN1N2N3(a, origin, n1, n2, n3 [3]float64, angle float64) (b [3]float64, err error)
- func RotateTransPt(a, origin, trans [3]float64, Q [][]float64) (b [3]float64)
- func RotateX(a, origin [3]float64, angle float64) (b [3]float64)
- func RotateY(a, origin [3]float64, angle float64) (b [3]float64)
- func RotateZ(a, origin [3]float64, angle float64) (b [3]float64)
- func ScalerMult(a [3]float64, b float64) (result [3]float64)
- func Subtract(a, b [3]float64) (result [3]float64)
- func Translate(a, dir [3]float64) (b [3]float64)
- func TranslateDist(a, dir [3]float64, dist float64) (b [3]float64)
- func Transpose2dFloat(A [][]float64) (B [][]float64, err error)
- func TriNormal(n1, n2, n3 [3]float64) [3]float64
- func YawPitchRoll(yaw, pitch, roll float64, pt [3]float64) (rotpt [3]float64)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CrossProduct ¶
CrossProduct returns the crossproduct of a and b a and b are 3d vectors
func DistPt2Line ¶
DistPt2Line returns the shortest distance from b to the line defined by a and n a is a point on the line n is the vector of the line b is a point not on the line The result is the shortest distance from b to the line
func DistPt2Pt ¶
DistPt2Pt returns the distance from 3d point a to 3d point b a is a point b is another point The result is the shortest distance from b to the line
func DotProduct ¶
DotProduct returns the dot product of 3d vectors a and b.
func GetComplexRotationMatrix ¶
GetComplexRotationMatrix returns a compound rotation matrix for rotating about the x, y, and z axis respectively.
func GetRotationMatrix ¶
GetRotationMatrix returns the Q matrix needed for RotateTransPt
func GetSignedAngle ¶
GetSignedAngle returns the signed angle theta (radians) between 3d vectors a and b about the given the axis.
func Make2D ¶
Make2D creates a slice of dimension [r][c]. In terms of a matrix, this is analogous to an r row by c column matrix.
func Make3D ¶
Make3D creates a slice of dimension [r][c][d]. In terms of a matrix, this is analogous to an r row by c column by d depth matrix.
func NearestPtOnLine ¶
NearestPtOnLine returns the point on a line defined by point a and normalized vector n that is closest to b a is a point on the line n is the NORMALIZED vector of the line b is a point not necessarily on the line
func ReflectX ¶
ReflectX moves a point to its mirrored location about the X plane a is the point to be moved b is the moved point
func ReflectY ¶
ReflectY moves a point to its mirrored location about the X plane a is the point to be moved b is the moved point
func ReflectZ ¶
ReflectZ moves a point to its mirrored location about the X plane a is the point to be moved b is the moved point
func Rotate3D ¶
Rotate3D rotates vector b by rotation matrix A. This is matrix multiplication of size 3x3 X 3x1 = 3x1.
func RotateAxis ¶
RotateAxis rotates a point a about an origin and an axis a specified angle (radians) a is the point to be moved b is the moved point It doesn't require the axis to be normalized.
func RotateN1N2 ¶
RotateN1N2 rotates a point a about an origin and an axis, formed by n2-n1, a specified angle (radians) a is the point to be moved b is the moved point
func RotateN1N2N3 ¶
RotateN1N2N3 rotates a point around an origin in the plane specified by three points in the plane (n1, n2, and n3) a is the point to be moved b is the moved point
func RotateTransPt ¶
RotateTransPt rotates a point given a rotation matrix Q, and an origin and translates it by trans
func RotateX ¶
RotateX rotates point a about the given origin and X axis a specified angle (radians) a is the point to be moved b is the moved point
func RotateY ¶
RotateY rotates point a about the given origin and Y axis a specified angle (radians) a is the point to be moved b is the moved point
func RotateZ ¶
RotateZ rotates point a about the given origin and Z axis a specified angle (radians) a is the point to be moved b is the moved point
func ScalerMult ¶
ScalerMult returns a * b a is three dimensional vector b is a scalar
func Translate ¶
Translate moves a 3d point a along the vector dir to 3d point b a is the point to be moved b is the moved point dir is a vector representing the direction and distance a is moved.
func TranslateDist ¶
TranslateDist moves a 3d point a along the vector dir a distance d to 3d point b a is the point to be moved b is the moved point dir is a vector representing the direction and distance a is moved.
func Transpose2dFloat ¶
Transpose2dFloat creates the transpose of a rectangular 2-dimensional slice of type float64 as if it were a transposable matrix.
func TriNormal ¶
TriNormal returns the normal of a triangle with a normal that is the cross product of n2 - n1 and n3 - n2
func YawPitchRoll ¶
YawPitchRoll rotates a point through yaw, pitch, and roll, in that order according to the Tait-Bryan z-y'-x” intrinsic rotation convention. yaw, pitch, and roll are entered in degrees with bounds: -360 < yaw < 360; -360 < pitch < 360; -360 < roll < 360. pt is the point to be rotated. rotpt is the rotated point.
Types ¶
This section is empty.