pyacs.lib.euclid

euclid graphics maths module

Documentation and tests are included in the file “euclid.rst”, or online at https://github.com/ezag/pyeuclid/blob/master/euclid.rst

class pyacs.lib.euclid.Circle(center, radius)[source]

Bases: Geometry

c
connect(other)[source]
copy()
intersect(other)[source]
r
tangent_points(p)[source]
class pyacs.lib.euclid.Geometry[source]

Bases: object

connect(other)[source]
distance(other)[source]
intersect(other)[source]
class pyacs.lib.euclid.Line2(*args)[source]

Bases: Geometry

connect(other)[source]
copy()
intersect(other)[source]
p
property p1
property p2
v
class pyacs.lib.euclid.Line3(*args)[source]

Bases: object

connect(other)[source]
copy()
intersect(other)[source]
p
property p1
property p2
v
class pyacs.lib.euclid.LineSegment2(*args)[source]

Bases: Line2

property length
magnitude_squared()[source]
p
v
class pyacs.lib.euclid.LineSegment3(*args)[source]

Bases: Line3

property length
magnitude_squared()[source]
p
v
class pyacs.lib.euclid.Matrix3[source]

Bases: object

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

Bases: object

a
b
c
copy()
d
determinant()[source]
e
f
g
get_quaternion()[source]

Return a quaternion representing the rotation part of the matrix.

Algorithm from: http://web.archive.org/web/20041029003853/http://www.j3d.org/matrix_faq/matrfaq_latest.html#Q55

Returns:

Quaternion representing the rotation part.

Return type:

Quaternion

h
i
identity()[source]
inverse()[source]
j
k
l
m
n
classmethod new(*values)[source]
classmethod new_identity()[source]
classmethod new_look_at(eye, at, up)[source]
classmethod new_perspective(fov_y, aspect, near, far)[source]
classmethod new_rotate_axis(angle, axis)[source]
classmethod new_rotate_euler(heading, attitude, bank)[source]
classmethod new_rotate_triple_axis(x, y, z)[source]
classmethod new_rotatex(angle)[source]
classmethod new_rotatey(angle)[source]
classmethod new_rotatez(angle)[source]
classmethod new_scale(x, y, z)[source]
classmethod new_translate(x, y, z)[source]
o
p
rotate_axis(angle, axis)[source]
rotate_euler(heading, attitude, bank)[source]
rotate_triple_axis(x, y, z)[source]
rotatex(angle)[source]
rotatey(angle)[source]
rotatez(angle)[source]
scale(x, y, z)[source]
transform(other)[source]
translate(x, y, z)[source]
transpose()[source]
transposed()[source]
class pyacs.lib.euclid.Plane(*args)[source]

Bases: object

connect(other)[source]
copy()
intersect(other)[source]
k
n
class pyacs.lib.euclid.Point2(x=0, y=0)[source]

Bases: Vector2, Geometry

connect(other)[source]
intersect(other)[source]
x
y
class pyacs.lib.euclid.Point3(x=0, y=0, z=0)[source]

Bases: Vector3, Geometry

connect(other)[source]
intersect(other)[source]
x
y
z
class pyacs.lib.euclid.Quaternion(w=1, x=0, y=0, z=0)[source]

Bases: object

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

Bases: Line2

p
v
class pyacs.lib.euclid.Ray3(*args)[source]

Bases: Line3

p
v
class pyacs.lib.euclid.Sphere(center, radius)[source]

Bases: object

c
connect(other)[source]
copy()
intersect(other)[source]
r
class pyacs.lib.euclid.Vector2(x=0, y=0)[source]

Bases: object

angle(other)[source]

Return the angle to the vector other.

Parameters:

other (Vector2) – The other vector.

Returns:

Angle in radians.

Return type:

float

copy()
cross()[source]
dot(other)[source]
magnitude()
magnitude_squared()[source]
normalize()[source]
normalized()[source]
project(other)[source]

Return one vector projected on the vector other.

Parameters:

other (Vector2) – The vector to project onto.

Returns:

This vector projected onto other.

Return type:

Vector2

reflect(normal)[source]
x
y
class pyacs.lib.euclid.Vector3(x=0, y=0, z=0)[source]

Bases: object

angle(other)[source]

Return the angle to the vector other.

Parameters:

other (Vector3) – The other vector.

Returns:

Angle in radians.

Return type:

float

copy()
cross(other)[source]
dot(other)[source]
magnitude()
magnitude_squared()[source]
normalize()[source]
normalized()[source]
project(other)[source]

Return one vector projected on the vector other.

Parameters:

other (Vector3) – The vector to project onto.

Returns:

This vector projected onto other.

Return type:

Vector3

reflect(normal)[source]
rotate_around(axis, theta)[source]

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

Parameters:
  • axis (Vector3) – Rotation axis (will be normalized).

  • theta (float) – Rotation angle in radians.

Returns:

Rotated vector.

Return type:

Vector3

x
y
z