svgen.cartesian package#
Subpackages#
- svgen.cartesian.rectangle package
- Submodules
- svgen.cartesian.rectangle.corner module
CornerScalar
RectangleCorner
RectangleCorner.BOTTOM_LEFT
RectangleCorner.BOTTOM_RIGHT
RectangleCorner.TOP_LEFT
RectangleCorner.TOP_RIGHT
RectangleCorner.horizontal
RectangleCorner.on_bottom
RectangleCorner.on_left
RectangleCorner.on_right
RectangleCorner.on_top
RectangleCorner.origin()
RectangleCorner.origin_dx
RectangleCorner.origin_dy
RectangleCorner.vector_dx
RectangleCorner.vector_dy
RectangleCorner.vertical
- svgen.cartesian.rectangle.grid module
- Module contents
Rectangle
Rectangle.bottom_left
Rectangle.bottom_right
Rectangle.center
Rectangle.centered()
Rectangle.corner()
Rectangle.create()
Rectangle.dimensions
Rectangle.from_center()
Rectangle.height
Rectangle.location
Rectangle.origin
Rectangle.scale()
Rectangle.scale_whole()
Rectangle.square
Rectangle.to_square()
Rectangle.top_left
Rectangle.top_right
Rectangle.translate()
Rectangle.width
Submodules#
svgen.cartesian.angle module#
A module implementing an interface for angles.
- class svgen.cartesian.angle.DegreePrimitive(val: int)[source]#
Bases:
int
,Rotatable
A class to manage integer primitives for degrees within a 0 and 360 range.
- arc(count: int = 1, divisor: int = 2) DegreePrimitive [source]#
Rotate this angle around the circle.
- rotate(val: int) DegreePrimitive [source]#
Rotate this degree instance.
svgen.cartesian.circle module#
svgen - A module for interacting with circular entities.
- class svgen.cartesian.circle.Circle(radius: float, center: Point = (0.0, 0.0, True, -1))[source]#
Bases:
NamedTuple
A radius and center describing a circle.
- property attrs: CircleAttrs#
Get the ‘radius’ and ‘center’ attributes for this circle.
- property center_attrs: PointAttrs#
Get the ‘center’ attributes for this circle.
- radius: float#
Alias for field number 0
- property radius_attr: SimpleAttribute#
Get the ‘radius’ attribute for this circle.
- translate(move: Translation) Circle [source]#
Move this circle by a given translation.
- class svgen.cartesian.circle.CircleAttrs(radius: SimpleAttribute, center: PointAttrs)[source]#
Bases:
NamedTuple
A grouping for ‘width’ and ‘center’ attributes for a cicle.
- center: PointAttrs#
Alias for field number 1
- radius: SimpleAttribute#
Alias for field number 0
- property radius_val: float#
Get the ‘radius’ value for this circle.
svgen.cartesian.mutate module#
A module implementing cartesian object mutations.
- class svgen.cartesian.mutate.Angle(degrees: float, radians: float, sin: float, cos: float)[source]#
Bases:
NamedTuple
A definition of angle attributes.
- cos: float#
Alias for field number 3
- degrees: float#
Alias for field number 0
- radians: float#
Alias for field number 1
- sin: float#
Alias for field number 2
- class svgen.cartesian.mutate.Translation(dx: float = 0.0, dy: float = 0.0)[source]#
Bases:
NamedTuple
A definition of a translation in a Cartesian coordinate system.
- dx: float#
Alias for field number 0
- dy: float#
Alias for field number 1
- static normalize(dx: Translation | float, *args, **kwargs) Translation [source]#
Normalize input data into a translation.
- rotate(angle: Angle = (90.0, 1.5707963267948966, 1.0, 6.123233995736766e-17)) Translation [source]#
Rotate this translation vector by some angle.
svgen.cartesian.plane module#
A module for working with two-dimensional planes.
svgen.cartesian.point module#
A module for interfacing with points.
- class svgen.cartesian.point.Point(x: float = 0.0, y: float = 0.0, center: bool = False, idx: int = -1)[source]#
Bases:
NamedTuple
A definition of a point in a Cartesian coordinate system.
- property attrs: PointAttrs#
Get the ‘x’ and ‘y’ attributes for this point.
- center: bool#
Alias for field number 2
- idx: int#
Alias for field number 3
- translate(move: Translation | float, *args) Point [source]#
Move a point by a given translation.
- with_index(idx: int) Point [source]#
Get a new point with the specified index, from an existing point.
- x: float#
Alias for field number 0
- property x_attr: SimpleAttribute#
Get the ‘x’ attribute for this point.
- y: float#
Alias for field number 1
- property y_attr: SimpleAttribute#
Get the ‘y’ attribute for this point.
- class svgen.cartesian.point.PointAttrs(x: SimpleAttribute, y: SimpleAttribute)[source]#
Bases:
NamedTuple
A grouping for ‘x’ and ‘y’ attributes.
- x: SimpleAttribute#
Alias for field number 0
- property x_val: float#
Get the ‘x’ coordinate for these attributes.
- y: SimpleAttribute#
Alias for field number 1
- property y_val: float#
Get the ‘y’ coordinate for these attributes.
- class svgen.cartesian.point.PointManager(points: Dict[str, Point] = None)[source]#
Bases:
object
A class for managing points.
- add_point(name: str, point: Point | float, *args) Point [source]#
Add a named point to this manager.
- translate(move: Translation | float, *args) None [source]#
Translate all entities in the plane by some amount.
Module contents#
svgen - A module for Cartesian-coordinate interfaces.
- class svgen.cartesian.DimensionAttrs(width: SimpleAttribute, height: SimpleAttribute)[source]#
Bases:
NamedTuple
A grouping for ‘width’ and ‘height’ attributes.
- height: SimpleAttribute#
Alias for field number 1
- property height_val: float#
Get the ‘height’ value for these dimensions.
- width: SimpleAttribute#
Alias for field number 0
- property width_val: float#
Get this ‘width’ value for these dimensions.
- class svgen.cartesian.Dimensions(width: float, height: float)[source]#
Bases:
NamedTuple
A set of dimensions describing a rectangular entity.
- property attrs: DimensionAttrs#
Get the ‘width’ and ‘height’ attributes for these dimensions.
- property dx: float#
An alias for width.
- property dy: float#
An alias for height.
- height: float#
Alias for field number 1
- property height_attr: SimpleAttribute#
Get the ‘height’ attribute for these dimensions.
- scale(width_scale: float = 1.0, height_scale: float = 1.0) Dimensions [source]#
Scale these dimensions.
- property square: bool#
Determine if these dimensions are square.
- to_centered_square(scale: float = 1.0) Tuple[Dimensions, Translation] [source]#
Make dimensions square and determine the resulting translation that would be needed to logically center the new object.
- to_square(scale: float = 1.0) Dimensions [source]#
Convert these dimensions to a scaled square.
- width: float#
Alias for field number 0
- property width_attr: SimpleAttribute#
Get the ‘width’ attribute for these dimensions.