index of namespace default
 
 index of project tkmath
 
 index of module tkmath

Class tkmath.Vector3f


SynopsisThis class represents a single precision 3 dimensional coordinate vector.

  Methods:

Method add
Add another vector v to this instance
Signature
add(Vector3fv)
Arguments
Vector3fvvector to add

 
 top of page
Method add3f
Translate x / y / z components
Signature
add3f(floattx,
  floatty,
  floattz 
  )  
Arguments
floattx
floatty
floattz

 
 top of page
Method addf
Add scalar value to all components
Signature
addf(floatv)
Arguments
floatvscalar value

 
 top of page
Method bilinearQuadPos
Calc interpolated quad position from normalized (0..1) coordinates (0;0=left/top)
Signature
bilinearQuadPos()

 
 top of page
Method clamp
Clamp to length
Signature
clamp(floatl)
Arguments
floatlMaximum length of vector

See also:  


 
 top of page
Method cross
Calculate cross product from this instance and v
Signature
cross(Vector3fv)
 :Vector3f
Arguments
Vector3fvVector3f instance
Returns
Vector3forthogonal vector to this instance and v

 
 top of page
Method distanceToPlane
Calc distance of vertex to plane defined by Vector3f q (on plane) and plane normal n
Signature
distanceToPlane(Vector3fq,
  Vector3fn 
  )  
 :float
Arguments
Vector3fqPoint on plane
Vector3fnPlane normal
Returns
floatdistance

 
 top of page
Method distanceToSphere
Calc distance of vertex to sphere defined by Vector3f p (sphere center) and sphere radius.
Signature
distanceToSphere(Vector3fp,
  floatradius 
  )  
 :float
Arguments
Vector3fpSphere center
floatradiusSphere radius
Returns
floatDistance to sphere center (within sphere when less than radius)

 
 top of page
Method divz
Divide by Z and return (2D) Vector2f
Signature
divz()

 
 top of page
Method dot
Calculate scalar dot product from this instance and v
Signature
dot(Vector3fv)
 :float
Arguments
Vector3fvVector3f instance
Returns
floatscalar value

 
 top of page
Method getAbs
Return length of vector
Signature
getAbs():float
Returns
floatlength of vector

 
 top of page
Method getAbsSqr
Return squared length of vector
Signature
getAbsSqr():float
Returns
floatlength2 of vector

 
 top of page
Method getString
Get string representation of vector (x, y, z)
Signature
getString():String
Returns
Stringstring representation of vector

 
 top of page
Method getX
Get value of x element
Signature
getX():float
Returns
floatvalue of x element

 
 top of page
Method getXy
Get xy vector
Signature
getXy():float
Returns
floatxy vector

 
 top of page
Method getXz
Get xz vector
Signature
getXz():float
Returns
floatxz vector

 
 top of page
Method getY
Get value of y element
Signature
getY():float
Returns
floatvalue of y element

 
 top of page
Method getYx
Get yx vector
Signature
getYx():float
Returns
floatyx vector

 
 top of page
Method getZ
Get value of z element
Signature
getZ():float
Returns
floatvalue of z element

 
 top of page
Method init
Initialize vector from scalars
Signature
init(floatx,
  floaty,
  floatz 
  )  
Arguments
floatx
floaty
floatz

 
 top of page
Method initScalef
Initialize vector to s*v
Signature
initScalef(Vector3fv,
  floats 
  )  
Arguments
Vector3fvVector3f instance
floatsscale to multiply

 
 top of page
Method intersectPlane
Calc intersection between line (p1->p2) and plane (q,n).
Signature
intersectPlane(Vector3fq,
  Vector3fn,
  Vector3fp1,
  Vector3fp2 
  )  
 :boolean
Arguments
Vector3fqPoint on plane
Vector3fnPlane normal
Vector3fp1Line start point
Vector3fp2Line end point
Returns
booleantrue when intersection was found. false when plane and line are colinear (or when any parameter object is invalid).

 
 top of page
Method isWithinSphere
Check if vertex is located within sphere defined by Vector3f p (sphere center) and squared sphere radius 'radiusSquared'.
Signature
isWithinSphere(Vector3fp,
  floatradiusSquared 
  )  
 :boolean
Arguments
Vector3fpSphere center
floatradiusSquaredSquared sphere radius
Returns
booleantrue if squared distance to sphere center is less than squared radius

 
 top of page
Method lerp
Linear interpolate to another vector
Signature
lerp(Vector3fo)
Arguments
Vector3foVector3f to interpolate to

 
 top of page
Method mul
Multiply the x element of this instance by the x element of v and do the same with the y and z element
Signature
mul(Vector3fv)
Arguments
Vector3fvVector3f instance

 
 top of page
Method mul3f
Scale x / y / z components
Signature
mul3f(floatsx,
  floatsy,
  floatsz 
  )  
Arguments
floatsx
floatsy
floatsz

 
 top of page
Method mulf
Multiply this instance by scalar value v
Signature
mulf(floatv)
Arguments
floatvscalar value

 
 top of page
Method New
Initialize and return new Vector3f instance
Signature
New(floatx,
  floaty,
  floatz 
  )  
 :Vector3f
Arguments
floatx
floaty
floatz
Returns

 
 top of page
Method setX
Set x element to a
Signature
setX(floata)
Arguments
floatanew value for x

 
 top of page
Method setY
Set y element to a
Signature
setY(floata)
Arguments
floatanew value for y

 
 top of page
Method setZ
Set z element to a
Signature
setZ(floata)
Arguments
floatanew value for z

 
 top of page
Method sub
Substract another vector v from this instance
Signature
sub(Vector3fv)
Arguments
Vector3fvvector to substract

 
 top of page
Method tensor
Create resulting matrix of tensor product from this instance and v
Signature
tensor(Vector3fv)
 :Matrix3f
Arguments
Vector3fv
Returns
Matrix3fMatrix3f instance

 
 top of page
Method transform
Multiply matrix by this vector.
Signature
transform(Matrixm)
Arguments
MatrixmMatrix3f (all call styles), or Matrix4f (rval,rarg)

 
 top of page
Method triple
Calculate triple product this.dot(b.cross(c)) (a*(bxc))
Signature
triple(Vector3fb,
  Vector3fc 
  )  
 :float
Arguments
Vector3fb
Vector3fc
Returns
floatscalar value
Description
ærg b second parameter of triple product arg c third parameter of triple product

 
 top of page
Method unit
Scale vector to length 1 if possible
Signature
unit()

 
 top of page
Method unitScale
Set length to s
Signature
unitScale(floats)
Arguments
floatsnew length of vector

 
 top of page
Method unitSphere
Map to point on sphere
Signature
unitSphere()
Description
http://mathproofs.blogspot.com/2005/07/mapping-cube-to-sphere.html via https://youtu.be/sLqXFF8mlEU

 
 top of page
 

Project Modules:tkmath 
Project Classes:Complexd , Complexf , Math , Matrix , Matrix2d , Matrix2f , Matrix2x3f , Matrix3d , Matrix3f , Matrix4d , Matrix4f , Quaterniond , Quaternionf , Vector2d , Vector2f , Vector3d , Vector3f , Vector4d , Vector4f 
Project Functions:absd , absf , acoscd , acoscf , acosd , acosf , acoshcd , acoshcf , acoshd , acoshf , asincd , asincf , asind , asinf , asinhcd , asinhcf , asinhd , asinhf , atan2d , atan2f , atancd , atancf , atand , atanf , atanhcd , atanhcf , atanhd , atanhf , ceild , ceilf , complexd , complexf , complexfPolar , complexfPolar , coscd , coscf , cosd , cosf , coshcd , coshcf , coshd , coshf , exp10d , exp10f , exp2d , exp2f , expcd , expcf , expd , expf , f16_from_f32 , f32_from_f16 , floord , floorf , fx16_from_f16 , hypotd , hypotf , log10d , log10f , log2d , log2f , logcd , logcf , logd , logf , matrix2d , matrix2f , matrix2x3f , matrix3d , matrix3f , matrix4d , matrix4f , modd , modf , powcd , powcf , powd , powf , quaterniond , quaternionf , relCmpd , relCmpf , relErrCmpd , relErrCmpf , roundd , roundf , sincd , sincf , sind , sinf , sinhcd , sinhcf , sinhd , sinhf , sqrtcd , sqrtcf , sqrtd , sqrtf , tancf , tancf , tand , tanf , tanhcd , tanhcf , tanhd , tanhf , vector2d , vector2f , vector3d , vector3f , vector4d , vector4f 
All Namespaces:default , graph , ui 
All Projects:core , eqxmms , ShaderVG , ShaderVG_Text , tkanalogrytm , tkchipmunk , tkclap , tkfileutils , tkfreeglut , tkfreetype2 , tkfreeverb , tkmath , tkmidi , tkmidipipe , tkminnie , tkoldmath , tkopengl , tkportaudio , tkradiastools , tksamplechain , tksampleedit , tksampler , tksdl , tksdl_net , tksidplay2 , tkspeexdsp , tksqlite , tktriangulate , tkui , tkvst2 , tkzip , ui , yingtest 


auto-generated by "DOG", the TkScript document generator. Thu, 11/Dec/2025 13:42:00