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

Class tkmath.Vector4f


Synopsis: This class represents a single precision 4 dimensional euclidean space vector.

  Base classes:
  Methods:

Method add
Add vector or array-like object
Signature
add(Vector4fv)
Arguments
Vector4fv–vector to add

 
→ top of page
Method addf
Add scalar value to all components
Signature
addf(floatv)
Arguments
floatv–scalar 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
floatl–Maximum length of vector

See also:  


 
→ top of page
Method distanceToPlane
Calc distance of vertex to plane defined by Vector4f q (on plane) and plane normal n
Signature
distanceToPlane(Vector4fq,
  Vector4fn 
  )  
 :float
Arguments
Vector4fq–Point on plane
Vector4fn–Plane normal
Returns
float–distance

 
→ top of page
Method distanceToSphere
Calc distance of vertex to sphere defined by Vector4f p (sphere center) and sphere radius.
Signature
distanceToSphere(Vector4fp,
  floatradius 
  )  
 :float
Arguments
Vector4fp–Sphere center
floatradius–Sphere radius
Returns
float–Distance to sphere center (within sphere when less than radius)

 
→ top of page
Method divw
Divide by W and return Vector3f
Signature
divw()

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

 
→ top of page
Method dot
Calculate scalar dot product from this instance and v
Signature
dot(Vector4fv)
 :float
Arguments
Vector4fv–Vector4f or array-like object
Returns
float–scalar value

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

 
→ top of page
Method getAbsSqr
Return squared length of vector
Signature
getAbsSqr():float
Returns
float–length2 of vector

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

 
→ top of page
Method getW
Get value of w element
Signature
getW():float
Returns
float–value of w element

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

 
→ top of page
Method getXy
Get xy Vector2f
Signature
getXy():float
Returns
float–xy Vector2f

 
→ top of page
Method getXyz
Get xyz Vector3f
Signature
getXyz():float
Returns
float–xyz Vector3f

 
→ top of page
Method getXz
Get xz Vector2f
Signature
getXz():float
Returns
float–xz Vector2f

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

 
→ top of page
Method getYz
Get yz Vector2f
Signature
getYz():float
Returns
float–yz Vector2f

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

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

 
→ top of page
Method initScalef
Initialise vector to s*v
Signature
initScalef(Vector4fv,
  floats 
  )  
Arguments
Vector4fv–Vector4f or array-like object
floats–scale to multiply

 
→ top of page
Method intersectPlane
Calc intersection between line (p1->p2) and plane (q,n).
Signature
intersectPlane(Vector4fq,
  Vector4fn,
  Vector4fp1,
  Vector4fp2 
  )  
 :boolean
Arguments
Vector4fq–Point on plane
Vector4fn–Plane normal
Vector4fp1–Line start point
Vector4fp2–Line end point
Returns
boolean–true 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 Vector4f p (sphere center) and squared sphere radius 'radiusSquared'.
Signature
isWithinSphere(Vector4fp,
  floatradiusSquared 
  )  
 :boolean
Arguments
Vector4fp–Sphere center
floatradiusSquared–Squared sphere radius
Returns
boolean–true if squared distance to sphere center is less than squared radius

 
→ top of page
Method lerp
Linear interpolate to another vector
Signature
lerp(Vector4fo)
Arguments
Vector4fo–Vector4f 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, z and w elements
Signature
mul(Vector4fv)
Arguments
Vector4fv–Vector4f or array-like object

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

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

 
→ top of page
Method project
Convert clip to window coordinates
Signature
project()

 
→ top of page
Method rotate
Multiply matrix by this vector and replace this vector by the result
Signature
rotate(Matrix4fm)
Arguments
Matrix4fm–Matrix4f instance (rotation matrix)
Description

This is a convenience method to remove the need for temporary Vector4f variables in scripts (the temporary is created on the stack instead).

 
→ top of page
Method setW
Set w element to a
Signature
setW(floata)
Arguments
floata–new value for w

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

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

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

 
→ top of page
Method sub
Substract vector or array-like object
Signature
sub(Vector4fv)
Arguments
Vector4fv–vector to substract

 
→ top of page
Method tensor
Create resulting matrix of tensor product from this instance and v
Signature
tensor(Vector4fv)
 :Matrix4f
Arguments
Vector4fv–
Returns
Matrix4f–Matrix4f instance

 
→ top of page
Method transform
Multiply matrix by this vector
Signature
transform(Matrix4fm)
Arguments
Matrix4fm–

 
→ top of page
Method unit
Set length to 1
Signature
unit()

 
→ top of page
Method unitScale
Set length to s
Signature
unitScale(floats)
Arguments
floats–new length of vector

 
→ 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. Tue, 3/Mar/2026 18:10:18