Skip to content
CaptainBubbles edited this page Jul 3, 2014 · 9 revisions

RUL.RulVec

2D

Vec2 RandVec2(float lowerBoundX, float lowerBoundY, float upperBoundX, float upperBoundY)

lowerBoundX : Lower limit for the x-component
lowerBoundY : Lower limit for the y-component
upperBoundX : Upper limit for the x-component
upperBoundY : Upper limit for the y-component
Returns a random 2-dimensional vector within the specified range

Vec2 RandVec2(Vec2 baseVector, float maxXVariance, float maxYVariance)

baseVector : The vector that will be used as a base for the new random one
maxXVariance : The highest possible difference between the vectors' x-components
maxYVariance : The highest possible difference between the vectors' y-components
Returns a 2-dimensional vector whose components can vary from the base vector by a limited amount.

Vec2 RandVec2(Vec2 baseVector, float maxAngle)

baseVector : The vector that will be used as a base for the new random one
maxAngle : The greatest possible angle(in radians) between the base vector and the rotated random vector
Returns a randomly rotated version of the given base vector

Vec2 RandUnitVec2()

Returns a random 2-dimensional vector with the length 1

Vec2 RandVecInCircle(float circleRadius)

circleRadius : The radius of the circle containing the random vector
Returns a random 2-dimensional vector that lies in the circle with the specified radius

Vec2 RandDirection2()

Returns a 2-dimensional vector that points up, down, left or right

Clone this wiki locally