Skip to content
Martin Prout edited this page Jul 16, 2014 · 4 revisions

Usage of instance methods Vec2D:-

a * b where a is instance of Vec2D and b is a scalar a + b where both a and b are both instances of Vec2D a - b where both a and b are both instances of Vec2D a / b where a is instance of Vec2D and b is a scalar a == b where both a and b are both instances of Vec2D a.angle_between(b) where both a and b are both instances of Vec2D a.copy where a is instance of Vec2D returns a deep copy a.cross(b) where both a and b are both instances of Vec2D a.dist(b) where both a and b are both instances of Vec2D a.dot(b) where both a and b are both instances of Vec2D a.heading where a is instance of Vec2D a.lerp(b) where both a and b are both instances of Vec2D a.lerp!(b) where both a and b are both instances of Vec2D a.mag where a is instance of Vec2D
a.normalize where a is instance of Vec2D a.normalize! where a is instance of Vec2D a.normalize!(b) where both a and b are both instances of Vec2D a.rotate(b) where both a is an instance of Vec2D and b is scalar radians a.rotate!(b) where both a is an instance of Vec2D and b is scalar radians a.set_mag(b) where both a is instance of Vec2D and b is scalar a.set_mag(b) &block, a conditional variant where &block evaluates to a boolean a.to_a returns an array [x, y] where a is instance of Vec2D a.to_s returns a string where a is instance of Vec2D a.to_vertex(b) where b is a instance of Render sends vector a to PApplet.vertex a.x returns x as a float where a is instance of Vec2D a.x=b sets the x value of Vec2D a to the float b a.y returns y as a float where a is instance of Vec2D a.y=b sets the y value of Vec2D a to the float b

Usage of class methods Vec2D:-

Vec2D.from_angle(a) returns a new Vec2D object where a is a float radians Vec2D.new(a, b) where a and b are both floats

Usage of instance methods Vec3D

a * b where a is instance of Vec3D and b is a scalar a + b where both a and b are both instances of Vec3D a - b where both a and b are both instances of Vec3D a / b where a is instance of Vec3D and b is a scalar a == b where both a and b are both instances of Vec3D a.angle_between(b) where both a and b are both instances of Vec3D
a.copy where a is instance of Vec3D returns a deep copy a.cross(b) where both a and b are both instances of Vec3D
a.dist(b) where both a and b are both instances of Vec3D
a.dist_squared(b) where both a and b are both instances of Vec3D
a.dot(b) where both a and b are both instances of Vec3D
a.mag where a is instance of Vec3D
a.mag_squared where a is instance of Vec3D
a.normalize where a is instance of Vec3D
a.normalize! where a is instance of Vec3D
a.set_mag(b) where a is instance of Vec3D and b is a scalar
a.set_mag(b) &block, a conditional variant where &block evaluates to a boolean a.to_a returns array [x, y, z] where a is an instance of Vec3D
a.to_normal(b) where b is a instance of Render sends vector a to PApplet.normal a.to_s where a is instance of Vec3D
a.to_vertex(b) where b is a instance of Render sends vector a to PApplet.vertex a.to_vertex_uv(b, u, v) where b is a instance of Render sends vector a to PApplet.vertex, with float u and v (texture)
a.x returns x as a float where a is instance of Vec2D a.x = b sets the x value of Vec3D a to the float b a.y returns y as a float where a is instance of Vec2D a.y = b sets the y value of Vec3D a to the float b a.z returns z as a float where a is instance of Vec2D a.z = b sets the z value of Vec3D a to the float b

Usage of class methods Vec3D"

Vec3D.new(a, b, c) were a, b, and c are all floats

Clone this wiki locally