geom¶
A basic geom package.
domonic.geom¶
written by.ai
- class domonic.geom.matrix(m)[source]
[matrixs]
- rotate(pt)[source]
Rotates the point on the vector defined by the vectors m[0] and m[1].
- scale(pt)[source]
Scales the point on the vector defined by the vectors m[0] and m[1].
- translate(pt)[source]
Translates the point on the vector defined by the vectors m[0] and m[1].
domonic.geom.shape¶
- class domonic.geom.shape.Ellipse(x, y, width, height, color=None)[source]
- class domonic.geom.shape.Line(start, end, color=None, *args)[source]
- class domonic.geom.shape.Oval(radius=2.5, size=3)[source]
- domonic.geom.shape.Point
alias of
vertex
- class domonic.geom.shape.Polygon(points)[source]
- class domonic.geom.shape.Polyline(points)[source]
- class domonic.geom.shape.Rect(x=0, y=0, width=1, height=1, color=None)[source]
- property height
determine the height of the shape
- property width
determine the width of the shape
- class domonic.geom.shape.Shape(x=0, y=0, color='red', vertices=[])[source]
- draw(svg)[source]
draw the shape
- property height
determine the height of the shape
- rotate(angle)[source]
rotate the shape
- property width
determine the width of the shape
- class domonic.geom.shape.Square(x=0, y=0, size=1.0, color=None)[source]
- class domonic.geom.shape.vertex(x: float = 0, y: float = 0)[source]
A vertex is a point in the shape.
domonic.geom.vec2¶
- class domonic.geom.vec2.vec2(x: float = 0, y: float = 0)[source]
[vec2]
- add(pt)[source]
Adds a point to this point. returns new one
- angle()[source]
returns the angle of this vector in radians
- angleBetween(other)[source]
returns the angle between this and another vector in radians
- static cmp(a, b)[source]
Compare two vectors.
- copy()[source]
Creates a copy of this Point object.
- copyRotateAround(target, angle)[source]
moves the vector then rotate
- cross(other)[source]
Returns the cross product of this and other. The cross product is considered 0 perpendicular to each other point
- dot(other)[source]
Returns the dot product of these two vectors
- equals(other)[source]
Returns true if all vectors components are the same
- interpolate(pt1, pt2, t)[source]
Calculates the point that would be reached by this Point if we moved by a given distance vector over time t. Only floats are handled here.
- json()[source]
returns a json representation of this vector
- length()[source]
returns the length of this vector
- negate()[source]
Negate a vector. This results in vector with the same direction but different length
- negative()[source]
return vector but negative version
- normalize()[source]
returns a normalized vector
- obj()[source]
returns a obj representation of this vector
- static random(min_x, max_x, min_y, max_y)[source]
returns a random vector
- static random_point_in_circle(center, radius)[source]
returns a random point in a circle
- static random_point_in_rectangle(min_x, max_x, min_y, max_y)[source]
returns a random point in a rectangle
- static random_unit_vector(min_x, max_x, min_y, max_y)[source]
returns a random unit vector
- rotate(angle)[source]
rotates this vector by an angle in radians
- rotateAround(target, angle)[source]
Rotates the vector around another point. In fact it returns the other point.
- squaredlength()[source]
returns the squared length of this vector
- subtract(pt)[source]
Subtract from this point. returns new one
domonic.geom.vec3¶
- class domonic.geom.vec3.vec3(x: float = 0, y: float = 0, z: float = 0)[source]
[vec3]
- apply(point, amount)[source]
Moves the points x,y,z by amount.
- clone()[source]
Returns a new instance of this vector3.
- copy()[source]
Creates a copy of this object.
- distance(other)[source]
Returns the distance between this point and another vector3.
- equals(other)[source]
Determine whether two objects are identical.
- subtract(point)[source]
Subtract from this point.