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

Class tkmath.Vector2f


Synopsis: This class represents a single precision 2 dimensional coordinate vector.

  Base classes:
  Methods:

Method add
Add another vector v to this instance
Signature
add(Vector2fv)
Arguments
Vector2fv–Vector to add

 
→ top of page
Method add2f
Translate x / y components
Signature
add2f(floattx,
  floatty 
  )  
Arguments
floattx–
floatty–

 
→ 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 cross
Returns the z component of the orthogonal vector of the cross product
Signature
cross(Vector2fv)
 :float
Arguments
Vector2fv–Other vector (2f or 3f)
Returns
float–Z component of orthogonal cross product vector (this X v)

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

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

 
→ top of page
Method dot
Calculate dot product from this instance and v
Signature
dot(Vector2fv)
 :float
Arguments
Vector2fv–Vector2f instance
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 getAngle
Returns angular direction (in radians) (0=north/0;1)
Signature
getAngle():float
Returns
float–angle

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

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

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

 
→ top of page
Method getYX
Get yx vector
Signature
getYX():float
Returns
float–yx vector

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

 
→ top of page
Method initAngle
Initializes vector from angle (in radians) (0=north/0;1)
Signature
initAngle()

 
→ top of page
Method initScalef
Initialise values to s*v
Signature
initScalef(Vector2fv,
  floats 
  )  
Arguments
Vector2fv–Vector2f instance
floats–scale to multiply

 
→ top of page
Method intersect
Returns intersection point in 'this'
Signature
intersect(Vector2fv,
  floats 
  )  
Arguments
Vector2fv–
floats–
Description
Returns normalized position on edge v2s<>v2e.

 
→ top of page
Method isWithinSphere
Check if vertex is located within sphere defined by Vector2f p (sphere center) and squared sphere radius 'radiusSquared'.
Signature
isWithinSphere(Vector2fp,
  floatradiusSquared 
  )  
 :boolean
Arguments
Vector2fp–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(Vector2fo)
Arguments
Vector2fo–Vector2f 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 element
Signature
mul(Vector2fv)
Arguments
Vector2fv–Vector2f instance

 
→ top of page
Method mul2f
Scale x / y components
Signature
mul2f(floatsx,
  floatsy 
  )  
Arguments
floatsx–
floatsy–

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

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

 
→ top of page
Method rotateCCW90
Rotate 90 degrees counter-clock-wise (x = -y, y = x)
Signature
rotateCCW90()

 
→ top of page
Method rotateCW90
Rotate 90 degrees clock-wise (x = y, y = -x)
Signature
rotateCW90()

 
→ top of page
Method rotatef
Rotate about z axis
Signature
rotatef()

 
→ 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 sub
Substract another vector v from this instance
Signature
sub(Vector2fv)
Arguments
Vector2fv–Vector to substract

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

 
→ top of page
Method transform
Multiply matrix by this vector.
Signature
transform(Matrixm)
Arguments
Matrixm–Matrix2f (all call styles), or Matrix[34]f (rval,rarg)

 
→ 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
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. Wed, 27/May/2026 15:27:24