Skip to content

A GLua implementation of Vector. Featuring rigid optimization & precise calculations due to components being doubles.

License

Notifications You must be signed in to change notification settings

noaccessl/glua-SharpVector

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 

Repository files navigation

glua-SharpVector

A GLua implementation of Vector with rigorous optimization & high precision because Lua numbers are doubles.

My initial motive

The original idea was to write a GLua variant of Vector because in Lua numbers are stored as doubles (Double-precision floating-point format) while in the engine Vector's components are stored as floats (32 bits long; higher probability of precision loss on very small scales).

This script can be very handy if you need performant and high-precision vectors.

Doc

All pivotal details are concisely described/explained in the code.

All default Vector functions are present. SharpVector() features the same argument overload as Vector().

Functions compatible with Vector:

  • SharpVector:SetGModVector( vec )
  • SharpVector:AddGModVector( vec )
  • SharpVector:SubGModVector( vec )
  • SharpVector:MulByGModVector( vec )
  • SharpVector:DivByGModVector( vec )

Extensions:

  • Vector? SharpVector:AsGModVector( [vecOutput] )
  • SharpVector Vector:Sharpened()
  • SharpVector? SharpVector:Lerp( sharpvecTarget, fraction[, sharpvecOutput] )

Features:

  • SharpVector:Normalize() returns the length in addition.
  • Functions returning a new object have additional final argument as the output for it (where reasonable).
    (Cross, ToColor, ToTable, Angle, AngleEx)
  • SharpVector:Rotate has a second argument as the output for transformation.

About

A GLua implementation of Vector. Featuring rigid optimization & precise calculations due to components being doubles.

Resources

License

Stars

Watchers

Forks

Languages