cocos.euclid module

euclid graphics maths module

Docs best viewed in the bundled euclid docs

class Circle(center, radius)

Bases: cocos.euclid.Geometry, cocos.euclid.Slotted

connect(other)
copy()
intersect(other)
c
r
class Geometry

Bases: object

connect(other)
distance(other)
intersect(other)
class Line2(*args)

Bases: cocos.euclid.Geometry, cocos.euclid.Slotted

connect(other)
copy()
intersect(other)
p
property p1
property p2
v
class Line3(*args)

Bases: cocos.euclid.Slotted

connect(other)
copy()
intersect(other)
p
property p1
property p2
v
class LineSegment2(*args)

Bases: cocos.euclid.Line2

magnitude_squared()
property length
p
v
class LineSegment3(*args)

Bases: cocos.euclid.Line3

magnitude_squared()
property length
p
v
class Matrix3

Bases: cocos.euclid.Slotted

copy()
determinant()
identity()
inverse()
classmethod new_identity()
classmethod new_rotate(angle)
classmethod new_scale(x, y)
classmethod new_translate(x, y)
rotate(angle)
scale(x, y)
translate(x, y)
a
b
c
e
f
g
i
j
k
class Matrix4

Bases: cocos.euclid.Slotted

copy()
determinant()
identity()
inverse()
classmethod new(*values)
classmethod new_identity()
classmethod new_look_at(eye, at, up)
classmethod new_perspective(fov_y, aspect, near, far)
classmethod new_rotate_axis(angle, axis)
classmethod new_rotate_euler(heading, attitude, bank)
classmethod new_rotate_triple_axis(x, y, z)
classmethod new_rotatex(angle)
classmethod new_rotatey(angle)
classmethod new_rotatez(angle)
classmethod new_scale(x, y, z)
classmethod new_translate(x, y, z)
rotate_axis(angle, axis)
rotate_euler(heading, attitude, bank)
rotate_triple_axis(x, y, z)
rotatex(angle)
rotatey(angle)
rotatez(angle)
scale(x, y, z)
transform(other)
translate(x, y, z)
transpose()
transposed()
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
class Plane(*args)

Bases: cocos.euclid.Slotted

connect(other)
copy()
intersect(other)
k
n
class Point2(x=0, y=0)

Bases: cocos.euclid.Vector2, cocos.euclid.Geometry

connect(other)
intersect(other)
x
y
class Point3(x=0, y=0, z=0)

Bases: cocos.euclid.Vector3, cocos.euclid.Geometry

connect(other)
intersect(other)
x
y
z
class Quaternion(w=1, x=0, y=0, z=0)

Bases: cocos.euclid.Slotted

conjugated()
copy()
get_angle_axis()
get_euler()
get_matrix()
identity()
magnitude()
magnitude_squared()
classmethod new_identity()
classmethod new_interpolate(q1, q2, t)
classmethod new_rotate_axis(angle, axis)
classmethod new_rotate_euler(heading, attitude, bank)
classmethod new_rotate_matrix(m)
normalize()
normalized()
rotate_axis(angle, axis)
rotate_euler(heading, attitude, bank)
rotate_matrix(m)
w
x
y
z
class Ray2(*args)

Bases: cocos.euclid.Line2

p
v
class Ray3(*args)

Bases: cocos.euclid.Line3

p
v
class Slotted

Bases: object

class Sphere(center, radius)

Bases: cocos.euclid.Slotted

connect(other)
copy()
intersect(other)
c
r
class Vector2(x=0, y=0)

Bases: cocos.euclid.Slotted

angle(other)

canonical angle between vectors, angle(u, v) = u dot v / (|u|*|v|)

Is the angle between the lines generated by self and other.

Range is [0, pi]

v.angle(w) == w.angle(v)

angle_oriented(other)

signed angle from self to other

The angle to rotate self so that it points in the same direction as other

Range is [-pi, pi]

v.angle(w) == - w.angle(v)

copy()
cross()
determinant(other)
dot(other)
magnitude()
magnitude_squared()
normalize()
normalized()
project(other)

Return one vector projected on the vector other

reflect(normal)
rotate(theta)
x
property xy

(x, y)

y
property yx

(y, x)

class Vector3(x=0, y=0, z=0)

Bases: cocos.euclid.Slotted

angle(other)

Return the angle to the vector other

copy()
cross(other)
dot(other)
magnitude()
magnitude_squared()
normalize()
normalized()
project(other)

Return one vector projected on the vector other

reflect(normal)
rotate_around(axis, theta)

Return the vector rotated around axis through angle theta. Right hand rule applies

x
property xy

(x, y)

property xyz

(x, y, z)

property xz

(x, z)

property xzy

(x, z, y)

y
property yx

(y, x)

property yxz

(y, x, z)

property yz

(y, z)

property yzx

(y, z, x)

z
property zx

(z, x)

property zxy

(z, x, y)

property zy

(z, y)

property zyx

(z, y, x)