Crate math2d

Source
Expand description

2D Mathematics library designed for use with 2D drawing applications.

Primarily designed for the needs of Direct2D, but this library should be perfectly capable of filling in the needs of other libraries such as Cairo. If you would like interoperability defitions added please feel free to open a pull request on the repository.

Currently compatible with:

  • Direct2D (winapi types)
  • Mint

Re-exports§

pub use color::Color;

Modules§

color
RGBA Colors. Many colors have predefined constants for convenience.

Structs§

ArcSegment
Describes an elliptical arc between two points. The starting point is implicit when an ArcSegment is used as part of a Path, as it is a continuation from the previous segment.
BezierSegment
Represents a cubic bezier segment drawn between two points. The first point in the bezier segment is implicitly the end point of the previous segment.
Ellipse
Contains the center point, x-radius, and y-radius of an ellipse.
Matrix3x2f
2D Affine Transformation Matrix.
Point2f
Mathematical point on the 2D (x, y) plane.
Point2i
Mathematical point on the 2D (x, y) plane.
Point2u
Mathematical point on the 2D (x, y) plane.
QuadBezierSegment
Contains the control point and end point for a quadratic Bezier segment.
Rectf
Represents a rectangle defined by the coordinates of the upper-left corner (left, top) and the coordinates of the lower-right corner (right, bottom).
Recti
Represents a rectangle defined by the coordinates of the upper-left corner (left, top) and the coordinates of the lower-right corner (right, bottom).
Rectu
Represents a rectangle defined by the coordinates of the upper-left corner (left, top) and the coordinates of the lower-right corner (right, bottom).
RoundedRect
Represents a rectangle with rounded corners described by ellipses that touch the internal edges of the rectangle at the tangent points.
Sizef
Stores an ordered pair of floating-point values, typically the width and height of a rectangle.
Sizeu
Stores an ordered pair of unsigned integer values, typically the width and height of a rectangle.
Thicknessf
Represents a margin around an axis-aligned rectangle.
Triangle
Represents a triangle described by its 3 corners.
Vector2f
Mathematical vector on the 2D (x, y) plane.
Vector2i
Mathematical vector on the 2D (x, y) plane.

Enums§

ArcSize
Specifies whether an arc should be greater than 180 degrees.
RectCorner
Represents a corner of the rectangle
SweepDirection
Defines the direction that an elliptical arc is drawn.