LuaSTG-x Core API
math::vec2 Class Reference

Public Member Functions

function __add (local other)
 
function __div (local other)
 
function __eq (local other)
 
function __mul (local other)
 
function __sub (local other)
 
function __tostring ()
 
function __unm ()
 
function add (local other)
 
function angle (local other)
 
function clamp (local min, local max)
 
function clone ()
 
function cross (local other)
 
function distance (local other)
 
function distanceSquared (local other)
 
function dot (local other)
 
function fuzzyEquals (local other, local var)
 
function getClamped (local min, local max)
 
function getMidpoint (local other)
 
function getNormalized ()
 
function getPerp ()
 
function getProjection (local other)
 
function getRotateAround (local point, local angle)
 
function getRotated (local other)
 
function getRPerp ()
 
function getScaled (local scalar)
 
function isFinite ()
 
function isOne ()
 
function isZero ()
 
function length ()
 
function lengthSquared ()
 
function lerp (local target, local alpha)
 
function negate ()
 
function normalize ()
 
static function one ()
 
function rotate (local point, local angle)
 
function scale (local scalar)
 
function set (local xx, local yy, local zz)
 
function setZero ()
 
function smooth (local target, local elapsedTime, local responseTime)
 
function subtract (local other)
 
static function zero ()
 

Public Attributes

table __index
 
number x
 
number y
 

Member Function Documentation

◆ __add()

function __add ( local  other)

◆ __div()

function __div ( local  other)

◆ __eq()

function __eq ( local  other)

◆ __mul()

function __mul ( local  other)

◆ __sub()

function __sub ( local  other)

◆ __tostring()

function __tostring ( )

◆ __unm()

function __unm ( )

◆ add()

function add ( local  other)

◆ angle()

function angle ( local  other)

◆ clamp()

function clamp ( local  min,
local  max 
)

◆ clone()

function clone ( )

◆ cross()

function cross ( local  other)

◆ distance()

function distance ( local  other)

◆ distanceSquared()

function distanceSquared ( local  other)

◆ dot()

function dot ( local  other)

◆ fuzzyEquals()

function fuzzyEquals ( local  other,
local  var 
)

◆ getClamped()

function getClamped ( local  min,
local  max 
)

◆ getMidpoint()

function getMidpoint ( local  other)

Calculates midpoint between two points

◆ getNormalized()

function getNormalized ( )

◆ getPerp()

function getPerp ( )

Calculates perpendicular of v, rotated 90 degrees counter-clockwise – cross(v, perp(v)) >= 0

◆ getProjection()

function getProjection ( local  other)

Calculates the projection of this over other.

Returns
math.vec2

◆ getRotateAround()

function getRotateAround ( local  point,
local  angle 
)

◆ getRotated()

function getRotated ( local  other)

Complex multiplication of two points ("rotates" two points), or rotate a point by angle.

Parameters
othermath.vec2|number vector or angle
Returns
math.vec2

◆ getRPerp()

function getRPerp ( )

Calculates perpendicular of v, rotated 90 degrees clockwise – cross(v, rperp(v)) <= 0

◆ getScaled()

function getScaled ( local  scalar)

◆ isFinite()

function isFinite ( )

◆ isOne()

function isOne ( )

◆ isZero()

function isZero ( )

◆ length()

function length ( )

◆ lengthSquared()

function lengthSquared ( )

◆ lerp()

function lerp ( local  target,
local  alpha 
)

◆ negate()

function negate ( )

◆ normalize()

function normalize ( )

◆ one()

static function one ( )

◆ rotate()

function rotate ( local  point,
local  angle 
)

Rotates this vector by angle (specified in radians) around the given point.

◆ scale()

function scale ( local  scalar)

◆ set()

function set ( local  xx,
local  yy,
local  zz 
)

◆ setZero()

function setZero ( )

◆ smooth()

function smooth ( local  target,
local  elapsedTime,
local  responseTime 
)

◆ subtract()

function subtract ( local  other)

◆ zero()

static function zero ( )

Member Data Documentation

◆ __index

table __index

◆ x

number x

◆ y

number y

The documentation for this class was generated from the following file: