Geometry

# Geometry

## Description

SwinGame's geometry code includes the features to create, draw, and manipulate shapes.

Adds the two parameter vectors (v1 and v2) together and returns the result as a new Vector.

• Add Vectors (const v1, const v2) : Vector [show]

Adds the two parameter vectors (v1 and v2) together and returns the result as a new Vector.

Parameters:
v1 : Vector
v2 : Vector
Returns:
Vector :
Signatures by Language:
C/C++: vector add_vectors(const vector *v1, const vector *v2);
C/C++: vector add_vectors_byval(const vector v1, const vector v2);
C++: vector add_vectors(const vector &v1, const vector &v2);
Pascal: function AddVectors(const v1: Vector; const v2: Vector): Vector;

### Apply Matrix

Apply the passed in Matrix2D to all of the points in the Point2DArray.

• Apply Matrix (const m, var pts) [show]

Apply the passed in Matrix2D to all of the points in the Point2DArray.

Parameters:
m : Matrix2D
pts : Point2DArray
Signatures by Language:
C/C++: void apply_matrix_to_points(const matrix2d *m, point2d *pts, int32_t pts_len);
C/C++: void apply_matrix_to_points_byval(const matrix2d m, point2d *pts, int32_t pts_len);
C++: void apply_matrix(const matrix2d &m, point2d *pts, int32_t pts_len);
Pascal: procedure ApplyMatrix(const m: Matrix2D; var pts: Point2DArray);
• Apply Matrix (const m, var tri) [show]

Use a matrix to transform all of the points in a triangle.

Parameters:
m : Matrix2D
tri : Triangle
Signatures by Language:
C/C++: void apply_matrix(const matrix2d *m, triangle *tri);
C/C++: void apply_matrix_byval(const matrix2d m, triangle *tri);
C++: void apply_matrix(const matrix2d &m, triangle &tri);
Pascal: procedure ApplyMatrix(const m: Matrix2D; var tri: Triangle);

### Calculate Angle

Calculates the angle from one vector to another.

• Calculate Angle (const v1, const v2) : Single [show]

Calculates the angle from one vector to another.

Parameters:
v1 : Vector
v2 : Vector
Returns:
Single :
Signatures by Language:
C/C++: float calculate_angle_between_vectors(const vector *v1, const vector *v2);
C/C++: float calculate_angle_between_vectors_byval(const vector v1, const vector v2);
C++: float calculate_angle(const vector &v1, const vector &v2);
Pascal: function CalculateAngle(const v1: Vector; const v2: Vector): Single;
• Calculate Angle (s1, s2) : Single [show]

Calculates the angle between two sprites.

Parameters:
s1 : Sprite
s2 : Sprite
Returns:
Single :
Signatures by Language:
C/C++: float calculate_angle_between_sprites(sprite s1, sprite s2);
C++: float calculate_angle(sprite s1, sprite s2);
Pascal: function CalculateAngle(s1: Sprite; s2: Sprite): Single;
• Calculate Angle (x1, y1, x2, y2) : Single [show]

Calculates the angle from x1,y1 to x2,y2.

Parameters:
x1 : Single
y1 : Single
x2 : Single
y2 : Single
Returns:
Single :
Signatures by Language:
C/C++: float calculate_angle(float x1, float y1, float x2, float y2);
Pascal: function CalculateAngle(x1: Single; y1: Single; x2: Single; y2: Single): Single;

### Calculate Angle Between

Calculates the angle between two points.

• Calculate Angle Between (const pt1, const pt2) : Single [show]

Calculates the angle between two points.

Parameters:
pt1 : Point2D
pt2 : Point2D
Returns:
Single :
Signatures by Language:
C/C++: float calculate_angle_between(const point2d *pt1, const point2d *pt2);
C/C++: float calculate_angle_between_byval(const point2d pt1, const point2d pt2);
C++: float calculate_angle_between(const point2d &pt1, const point2d &pt2);
Pascal: function CalculateAngleBetween(const pt1: Point2D; const pt2: Point2D): Single;

### Center Point

Return the center point of a circle.

• Center Point (const c) : Point2D [show]

Return the center point of a circle.

Parameters:
c : Circle
Returns:
Point2D :
Signatures by Language:
C/C++: point2d circle_center_point(const circle *c);
C/C++: point2d circle_center_point_byval(const circle c);
C++: point2d center_point(const circle &c);
Pascal: function CenterPoint(const c: Circle): Point2D;

### Circle At

Creates a circle at the given x,y location with the indicated radius.

• Circle At (x, y, radius) : Circle [show]

Creates a circle at the given x,y location with the indicated radius.

Parameters:
x : Single
y : Single
Returns:
Circle :
Signatures by Language:
C/C++: circle circle_from_xy(float x, float y, int32_t radius);
C++: circle circle_at(float x, float y, int32_t radius);
Pascal: function CircleAt(x: Single; y: Single; radius: Longint): Circle;
• Circle At (const pt, radius) : Circle [show]

Creates a Circle at the point pt with the given radius.

Parameters:
pt : Point2D
Returns:
Circle :
Signatures by Language:
C/C++: circle circle_at(const point2d *pt, int32_t radius);
C/C++: circle circle_at_byval(const point2d pt, int32_t radius);
C++: circle circle_at(const point2d &pt, int32_t radius);
Pascal: function CircleAt(const pt: Point2D; radius: Longint): Circle;

Returns the radius of the passed in circle.

• Circle Radius (const c) : Longint [show]

Returns the radius of the passed in circle.

Parameters:
c : Circle
Returns:
Longint :
Signatures by Language:
Pascal: function CircleRadius(const c: Circle): Longint;

### Circle Within Rect

Returns true if the circle is completely within the rectangle.

• Circle Within Rect (const c, const rect) : Boolean [show]

Returns true if the circle is completely within the rectangle.

Parameters:
c : Circle
rect : Rectangle
Returns:
Boolean :
Signatures by Language:
C/C++: bool circle_within_rect(const circle *c, const rectangle *rect);
C/C++: bool circle_within_rect_byval(const circle c, const rectangle rect);
C++: bool circle_within_rect(const circle &c, const rectangle &rect);
Pascal: function CircleWithinRect(const c: Circle; const rect: Rectangle): Boolean;

### Circle X

Returns the X value of the center point of a circle.

• Circle X (const c) : Single [show]

Returns the X value of the center point of a circle.

Parameters:
c : Circle
Returns:
Single :
Signatures by Language:
C/C++: float circle_x(const circle *c);
C/C++: float circle_x_byval(const circle c);
C++: float circle_x(const circle &c);
Pascal: function CircleX(const c: Circle): Single;

### Circle Y

Returns the Y value of the center point of a circle.

• Circle Y (const c) : Single [show]

Returns the Y value of the center point of a circle.

Parameters:
c : Circle
Returns:
Single :
Signatures by Language:
C/C++: float circle_y(const circle *c);
C/C++: float circle_y_byval(const circle c);
C++: float circle_y(const circle &c);
Pascal: function CircleY(const c: Circle): Single;

### Closest Point On Circle

Returns the point that lies on the circle's radius that is closest to the fromPt.

• Closest Point On Circle (const fromPt, const c) : Point2D [show]

Returns the point that lies on the circle's radius that is closest to the fromPt.

Parameters:
fromPt : Point2D
c : Circle
Returns:
Point2D :
Signatures by Language:
C/C++: point2d closest_point_on_circle(const point2d *fromPt, const circle *c);
C/C++: point2d closest_point_on_circle_byval(const point2d fromPt, const circle c);
C++: point2d closest_point_on_circle(const point2d &fromPt, const circle &c);
Pascal: function ClosestPointOnCircle(const fromPt: Point2D; const c: Circle): Point2D;

### Closest Point On Line

Returns the closest point on the line from the x,y point.

• Closest Point On Line (x, y, const line) : Point2D [show]

Returns the closest point on the line from the x,y point.

Parameters:
x : Single
y : Single
line : LineSegment
Returns:
Point2D :
Signatures by Language:
C/C++: point2d closest_point_on_line_xy(float x, float y, const line_segment *line);
C/C++: point2d closest_point_on_line_xy_byval(float x, float y, const line_segment line);
C++: point2d closest_point_on_line(float x, float y, const line_segment &line);
Pascal: function ClosestPointOnLine(x: Single; y: Single; const line: LineSegment): Point2D;
• Closest Point On Line (const fromPt, const line) : Point2D [show]

Returns the point on the line that is closest to the indicated point.

Parameters:
fromPt : Point2D
line : LineSegment
Returns:
Point2D :
Signatures by Language:
C/C++: point2d closest_point_on_line(const point2d *fromPt, const line_segment *line);
C/C++: point2d closest_point_on_line_byval(const point2d fromPt, const line_segment line);
C++: point2d closest_point_on_line(const point2d &fromPt, const line_segment &line);
Pascal: function ClosestPointOnLine(const fromPt: Point2D; const line: LineSegment): Point2D;

### Closest Point On Line From Circle

Returns the point on the line that is closest to the circle.

• Closest Point On Line From Circle (const c, const line) : Point2D [show]

Returns the point on the line that is closest to the circle.

Parameters:
c : Circle
line : LineSegment
Returns:
Point2D :
Signatures by Language:
C/C++: point2d closest_point_on_line_from_circle(const circle *c, const line_segment *line);
C/C++: point2d closest_point_on_line_from_circle_byval(const circle c, const line_segment line);
C++: point2d closest_point_on_line_from_circle(const circle &c, const line_segment &line);
Pascal: function ClosestPointOnLineFromCircle(const c: Circle; const line: LineSegment): Point2D;

### Closest Point On Lines From Circle

Returns the point on the lines that is closest in the indicated array from the circle.

• Closest Point On Lines From Circle (const c, const lines) : Point2D [show]

Returns the point on the lines that is closest in the indicated array from the circle.

Parameters:
c : Circle
lines : LinesArray
Returns:
Point2D :
Signatures by Language:
C/C++: point2d closest_point_on_lines_from_circle(const circle *c, const lines_array lines, int32_t lines_len);
C/C++: point2d closest_point_on_lines_from_circle_byval(const circle c, const lines_array lines, int32_t lines_len);
C++: point2d closest_point_on_lines_from_circle(const circle &c, const lines_array lines, int32_t lines_len);
Pascal: function ClosestPointOnLinesFromCircle(const c: Circle; const lines: LinesArray): Point2D;

### Closest Point On Rect From Circle

Returns the point on the rectangle that is closest to the circle.

• Closest Point On Rect From Circle (const c, const rect) : Point2D [show]

Returns the point on the rectangle that is closest to the circle.

Parameters:
c : Circle
rect : Rectangle
Returns:
Point2D :
Signatures by Language:
C/C++: point2d closest_point_on_rect_from_circle(const circle *c, const rectangle *rect);
C/C++: point2d closest_point_on_rect_from_circle_byval(const circle c, const rectangle rect);
C++: point2d closest_point_on_rect_from_circle(const circle &c, const rectangle &rect);
Pascal: function ClosestPointOnRectFromCircle(const c: Circle; const rect: Rectangle): Point2D;

### Cosine

Returns the cosine of the passed in angle (in degrees).

• Cosine (angle) : Single [show]

Returns the cosine of the passed in angle (in degrees).

Parameters:
angle : Single
Returns:
Single :
Signatures by Language:
C/C++: float cosine(float angle);
Pascal: function Cosine(angle: Single): Single;

### Create Circle

Creates a circle at the given x,y location with the indicated radius.

• Create Circle (x, y, radius) : Circle [show]

Creates a circle at the given x,y location with the indicated radius.

Parameters:
x : Single
y : Single
Returns:
Circle :
Signatures by Language:
C/C++: circle create_circle_from_xy(float x, float y, int32_t radius);
C++: circle create_circle(float x, float y, int32_t radius);
Pascal: function CreateCircle(x: Single; y: Single; radius: Longint): Circle;
• Create Circle (const pt, radius) : Circle [show]

Creates a Circle at the point pt with the given radius.

Parameters:
pt : Point2D
Returns:
Circle :
Signatures by Language:
C/C++: circle create_circle(const point2d *pt, int32_t radius);
C/C++: circle create_circle_byval(const point2d pt, int32_t radius);
C++: circle create_circle(const point2d &pt, int32_t radius);
Pascal: function CreateCircle(const pt: Point2D; radius: Longint): Circle;

### Create Line

Returns a line segment from x1,y1 to x2,y2.

• Create Line (x1, y1, x2, y2) : LineSegment [show]

Returns a line segment from x1,y1 to x2,y2.

Parameters:
x1 : Single
y1 : Single
x2 : Single
y2 : Single
Returns:
LineSegment :
Signatures by Language:
C/C++: line_segment create_line(float x1, float y1, float x2, float y2);
Pascal: function CreateLine(x1: Single; y1: Single; x2: Single; y2: Single): LineSegment;
• Create Line (const pt1, const pt2) : LineSegment [show]

Returns a line from pt1 to pt2.

Parameters:
pt1 : Point2D
pt2 : Point2D
Returns:
LineSegment :
Signatures by Language:
C/C++: line_segment create_line_point_to_point(const point2d *pt1, const point2d *pt2);
C/C++: line_segment create_line_point_to_point_byval(const point2d pt1, const point2d pt2);
C++: line_segment create_line(const point2d &pt1, const point2d &pt2);
Pascal: function CreateLine(const pt1: Point2D; const pt2: Point2D): LineSegment;

### Create Line As Vector

Returns a new Vector created from the start and end points of a LineSegment. Useful for calculating angle vectors or extracting a normal vector (see LineNormal) for the line.

• Create Line As Vector (const line) : Vector [show]

Returns a new Vector created from the start and end points of a LineSegment. Useful for calculating angle vectors or extracting a normal vector (see LineNormal) for the line.

Parameters:
line : LineSegment
Returns:
Vector :
Signatures by Language:
C/C++: vector create_line_as_vector(const line_segment *line);
C/C++: vector create_line_as_vector_byval(const line_segment line);
C++: vector create_line_as_vector(const line_segment &line);
Pascal: function CreateLineAsVector(const line: LineSegment): Vector;

### Create Line From Vector

Returns a line from the origin to the end of the mv vector.

• Create Line From Vector (const mv) : LineSegment [show]

Returns a line from the origin to the end of the mv vector.

Parameters:
mv : Vector
Returns:
LineSegment :
Signatures by Language:
C/C++: line_segment create_line_from_vector(const vector *mv);
C/C++: line_segment create_line_from_vector_byval(const vector mv);
C++: line_segment create_line_from_vector(const vector &mv);
Pascal: function CreateLineFromVector(const mv: Vector): LineSegment;
• Create Line From Vector (const pt, const mv) : LineSegment [show]

Returns a line from a starting point to the point at the end of the mv vector.

Parameters:
pt : Point2D
mv : Vector
Returns:
LineSegment :
Signatures by Language:
C/C++: line_segment create_line_vector_with_start_point(const point2d *pt, const vector *mv);
C/C++: line_segment create_line_vector_with_start_point_byval(const point2d pt, const vector mv);
C++: line_segment create_line_from_vector(const point2d &pt, const vector &mv);
Pascal: function CreateLineFromVector(const pt: Point2D; const mv: Vector): LineSegment;
• Create Line From Vector (x, y, const mv) : LineSegment [show]

Returns a line from the x,y starting point to the point at the end of the mv vector.

Parameters:
x : Single
y : Single
mv : Vector
Returns:
LineSegment :
Signatures by Language:
C/C++: line_segment create_line_vector_with_start_xy(float x, float y, const vector *mv);
C/C++: line_segment create_line_vector_with_start_xy_byval(float x, float y, const vector mv);
C++: line_segment create_line_from_vector(float x, float y, const vector &mv);
Pascal: function CreateLineFromVector(x: Single; y: Single; const mv: Vector): LineSegment;

### Create Rectangle

Returns a rectangle from a given x,y location with a given width and height.

• Create Rectangle (x, y, w, h) : Rectangle [show]

Returns a rectangle from a given x,y location with a given width and height.

Parameters:
x : Single
y : Single
w : Longint
h : Longint
Returns:
Rectangle :
Signatures by Language:
C/C++: rectangle create_rectangle(float x, float y, int32_t w, int32_t h);
Pascal: function CreateRectangle(x: Single; y: Single; w: Longint; h: Longint): Rectangle;
• Create Rectangle (const lines) : Rectangle [show]

Returns a rectangle that encloses the lines in the lines array.

Parameters:
lines : LinesArray
Returns:
Rectangle :
Signatures by Language:
C/C++: rectangle create_rectangle_lines(const lines_array lines, int32_t lines_len);
C++: rectangle create_rectangle(const lines_array lines, int32_t lines_len);
Pascal: function CreateRectangle(const lines: LinesArray): Rectangle;
• Create Rectangle (const tri) : Rectangle [show]

Returns a rectangle that encloses th epoints in a triangle.

Parameters:
tri : Triangle
Returns:
Rectangle :
Signatures by Language:
C/C++: rectangle create_rectangle_triangle(const triangle *tri);
C/C++: rectangle create_rectangle_triangle_byval(const triangle tri);
C++: rectangle create_rectangle(const triangle &tri);
Pascal: function CreateRectangle(const tri: Triangle): Rectangle;
• Create Rectangle (const line) : Rectangle [show]

Returns a rectangle that encloses the two points on the line segment.

Parameters:
line : LineSegment
Returns:
Rectangle :
Signatures by Language:
C/C++: rectangle create_rectangle_line(const line_segment *line);
C/C++: rectangle create_rectangle_line_byval(const line_segment line);
C++: rectangle create_rectangle(const line_segment &line);
Pascal: function CreateRectangle(const line: LineSegment): Rectangle;
• Create Rectangle (const c) : Rectangle [show]

Returns a rectangle that encloses a circle.

Parameters:
c : Circle
Returns:
Rectangle :
Signatures by Language:
C/C++: rectangle create_rectangle_circle(const circle *c);
C/C++: rectangle create_rectangle_circle_byval(const circle c);
C++: rectangle create_rectangle(const circle &c);
Pascal: function CreateRectangle(const c: Circle): Rectangle;
• Create Rectangle (const pt1, const pt2) : Rectangle [show]

Returns a rectangle with pt1 and pt2 defining the two distant edge points.

Parameters:
pt1 : Point2D
pt2 : Point2D
Returns:
Rectangle :
Signatures by Language:
C/C++: rectangle create_rectangle_for_points(const point2d *pt1, const point2d *pt2);
C/C++: rectangle create_rectangle_for_points_byval(const point2d pt1, const point2d pt2);
C++: rectangle create_rectangle(const point2d &pt1, const point2d &pt2);
Pascal: function CreateRectangle(const pt1: Point2D; const pt2: Point2D): Rectangle;
• Create Rectangle (const pt, width, height) : Rectangle [show]

Returns a rectangle at a given point with a specified width and height.

Parameters:
pt : Point2D
width : Longint
height : Longint
Returns:
Rectangle :
Signatures by Language:
C/C++: rectangle create_rectangle_at_point(const point2d *pt, int32_t width, int32_t height);
C/C++: rectangle create_rectangle_at_point_byval(const point2d pt, int32_t width, int32_t height);
C++: rectangle create_rectangle(const point2d &pt, int32_t width, int32_t height);
Pascal: function CreateRectangle(const pt: Point2D; width: Longint; height: Longint): Rectangle;

### Create Triangle

Returns a triangle from the points passed in.

• Create Triangle (ax, ay, bx, by, cx, cy) : Triangle [show]

Returns a triangle from the points passed in.

Parameters:
ax : Single
ay : Single
bx : Single
by : Single
cx : Single
cy : Single
Returns:
Triangle :
Signatures by Language:
C/C++: triangle create_triangle(float ax, float ay, float bx, float by, float cx, float cy);
Pascal: function CreateTriangle(ax: Single; ay: Single; bx: Single; by: Single; cx: Single; cy: Single): Triangle;
• Create Triangle (const a, const b, const c) : Triangle [show]

Returns a triangle made up of the three points passed in.

Parameters:
a : Point2D
b : Point2D
c : Point2D
Returns:
Triangle :
Signatures by Language:
C/C++: triangle create_triangle_points(const point2d *a, const point2d *b, const point2d *c);
C/C++: triangle create_triangle_points_byval(const point2d a, const point2d b, const point2d c);
C++: triangle create_triangle(const point2d &a, const point2d &b, const point2d &c);
Pascal: function CreateTriangle(const a: Point2D; const b: Point2D; const c: Point2D): Triangle;

### Create Vector From Angle

Returns a new Vector created using the angle and magnitude (length). The angle and magnitude are scalar values and the angle is in degrees.

• Create Vector From Angle (angle, magnitude) : Vector [show]

Returns a new Vector created using the angle and magnitude (length). The angle and magnitude are scalar values and the angle is in degrees.

Parameters:
angle : Single
magnitude : Single
Returns:
Vector :
Signatures by Language:
C/C++: vector create_vector_from_angle(float angle, float magnitude);
Pascal: function CreateVectorFromAngle(angle: Single; magnitude: Single): Vector;

### Create Vector From Point To Rect

Returns a vector from a point to the specified rectangle.

• Create Vector From Point To Rect (const pt, const rect) : Vector [show]

Returns a vector from a point to the specified rectangle.

Parameters:
pt : Point2D
rect : Rectangle
Returns:
Vector :
Signatures by Language:
C/C++: vector create_vector_from_point_pt_to_rectangle(const point2d *pt, const rectangle *rect);
C/C++: vector create_vector_from_point_pt_to_rectangle_byval(const point2d pt, const rectangle rect);
C++: vector create_vector_from_point_to_rect(const point2d &pt, const rectangle &rect);
Pascal: function CreateVectorFromPointToRect(const pt: Point2D; const rect: Rectangle): Vector;
• source code
• lib name: CreateVectorFromPointPtToRectangle
• Create Vector From Point To Rect (x, y, const rect) : Vector [show]

Returns a vector from the specified point to the specified rectangle.

Parameters:
x : Single
y : Single
rect : Rectangle
Returns:
Vector :
Signatures by Language:
C/C++: vector create_vector_from_point_to_rectangle(float x, float y, const rectangle *rect);
C/C++: vector create_vector_from_point_to_rectangle_byval(float x, float y, const rectangle rect);
C++: vector create_vector_from_point_to_rect(float x, float y, const rectangle &rect);
Pascal: function CreateVectorFromPointToRect(x: Single; y: Single; const rect: Rectangle): Vector;
• source code
• lib name: CreateVectorFromPointToRectangle
• Create Vector From Point To Rect (x, y, rectX, rectY, rectWidth, rectHeight) : Vector [show]

Returns a vector from the specified point to the specified rectangle.

Parameters:
x : Single
y : Single
rectX : Single
rectY : Single
rectWidth : Longint
rectHeight : Longint
Returns:
Vector :
Signatures by Language:
C/C++: vector create_vector_from_point_to_rect(float x, float y, float rectX, float rectY, int32_t rectWidth, int32_t rectHeight);
Pascal: function CreateVectorFromPointToRect(x: Single; y: Single; rectX: Single; rectY: Single; rectWidth: Longint; rectHeight: Longint): Vector;

### Create Vector From Points

Returns a Vector created from the difference from the p1 to the second p2 points (Point2D).

• Create Vector From Points (const p1, const p2) : Vector [show]

Returns a Vector created from the difference from the p1 to the second p2 points (Point2D).

Parameters:
p1 : Point2D
p2 : Point2D
Returns:
Vector :
Signatures by Language:
C/C++: vector create_vector_from_points(const point2d *p1, const point2d *p2);
C/C++: vector create_vector_from_points_byval(const point2d p1, const point2d p2);
C++: vector create_vector_from_points(const point2d &p1, const point2d &p2);
Pascal: function CreateVectorFromPoints(const p1: Point2D; const p2: Point2D): Vector;

### Create Vector To Point

Returns a new Vector using the x and y value of a Point2D parameter.

• Create Vector To Point (const p1) : Vector [show]

Returns a new Vector using the x and y value of a Point2D parameter.

Parameters:
p1 : Point2D
Returns:
Vector :
Signatures by Language:
C/C++: vector create_vector_to_point(const point2d *p1);
C/C++: vector create_vector_to_point_byval(const point2d p1);
C++: vector create_vector_to_point(const point2d &p1);
Pascal: function CreateVectorToPoint(const p1: Point2D): Vector;

### Distant Point On Circle

Returns the point at the opposite side of a circle from a given point pt.

• Distant Point On Circle (const pt, const c) : Point2D [show]

Returns the point at the opposite side of a circle from a given point pt.

Parameters:
pt : Point2D
c : Circle
Returns:
Point2D :
Signatures by Language:
C/C++: point2d distant_point_on_circle(const point2d *pt, const circle *c);
C/C++: point2d distant_point_on_circle_byval(const point2d pt, const circle c);
C++: point2d distant_point_on_circle(const point2d &pt, const circle &c);
Pascal: function DistantPointOnCircle(const pt: Point2D; const c: Circle): Point2D;

### Distant Point On Circle Heading

Finds the opposite side of a circle from a given point pt when travelling along the vector heading. Returns False if the ray projected from point pt misses the circle.

• Distant Point On Circle Heading (const pt, const c, const heading, out oppositePt) : Boolean [show]

Finds the opposite side of a circle from a given point pt when travelling along the vector heading. Returns False if the ray projected from point pt misses the circle.

Parameters:
pt : Point2D
c : Circle
oppositePt : Point2D
Returns:
Boolean :
Signatures by Language:
C/C++: bool distant_point_on_circle_heading(const point2d *pt, const circle *c, const vector *heading, point2d *oppositePt);
C/C++: bool distant_point_on_circle_heading_byval(const point2d pt, const circle c, const vector heading, point2d *oppositePt);
C++: bool distant_point_on_circle_heading(const point2d &pt, const circle &c, const vector &heading, point2d &oppositePt);
Pascal: function DistantPointOnCircleHeading(const pt: Point2D; const c: Circle; const heading: Vector; out oppositePt: Point2D): Boolean;

### Dot Product

Calculates the dot product (scalar product) between the two vector parameters rovided (v1 and v2). It returns the result as a scalar value.

If the result is 0.0 it means that the vectors are orthogonal (at right angles to each other). If v1 and v2 are unit vectors (length of 1.0) and the dot product is 1.0, it means that v1 and v2 vectors are parallel.

• Dot Product (const v1, const v2) : Single [show]

Calculates the dot product (scalar product) between the two vector parameters rovided (v1 and v2). It returns the result as a scalar value.

If the result is 0.0 it means that the vectors are orthogonal (at right angles to each other). If v1 and v2 are unit vectors (length of 1.0) and the dot product is 1.0, it means that v1 and v2 vectors are parallel.

Parameters:
v1 : Vector
v2 : Vector
Returns:
Single :
Signatures by Language:
C/C++: float dot_product(const vector *v1, const vector *v2);
C/C++: float dot_product_byval(const vector v1, const vector v2);
C++: float dot_product(const vector &v1, const vector &v2);
Pascal: function DotProduct(const v1: Vector; const v2: Vector): Single;

### Fix Rectangle

Ensures that the passed in rectangle has a positive width and height.

• Fix Rectangle (var rect) [show]

Ensures that the passed in rectangle has a positive width and height.

Parameters:
rect : Rectangle
Signatures by Language:
C/C++: void fix_rectangle(rectangle *rect);
C++: void fix_rectangle(rectangle &rect);
Pascal: procedure FixRectangle(var rect: Rectangle);
• Fix Rectangle (var x, var y, var width, var height) [show]

Ensures that the passed in rectangle has a positive width and height.

Parameters:
x : Single
y : Single
width : Longint
height : Longint
Signatures by Language:
C/C++: void fix_rect(float *x, float *y, int32_t *width, int32_t *height);
C++: void fix_rectangle(float &x, float &y, int32_t &width, int32_t &height);
Pascal: procedure FixRectangle(var x: Single; var y: Single; var width: Longint; var height: Longint);

### Identity Matrix

Returns the identity matrix. When a Matrix2D or Vector is multiplied by the identity matrix the result is the original matrix or vector.

• Identity Matrix () : Matrix2D [show]

Returns the identity matrix. When a Matrix2D or Vector is multiplied by the identity matrix the result is the original matrix or vector.

Returns:
Matrix2D :
Signatures by Language:
C/C++: matrix2d identity_matrix();
Pascal: function IdentityMatrix(): Matrix2D;

### Inset Rectangle

Returns a rectangle that is inset from rect the amount specified.

• Inset Rectangle (const rect, insetAmount) : Rectangle [show]

Returns a rectangle that is inset from rect the amount specified.

Parameters:
rect : Rectangle
insetAmount : Longint
Returns:
Rectangle :
Signatures by Language:
C/C++: rectangle inset_rectangle(const rectangle *rect, int32_t insetAmount);
C/C++: rectangle inset_rectangle_byval(const rectangle rect, int32_t insetAmount);
C++: rectangle inset_rectangle(const rectangle &rect, int32_t insetAmount);
Pascal: function InsetRectangle(const rect: Rectangle; insetAmount: Longint): Rectangle;

### Intersection

Returns the intersection of two rectangles.

• Intersection (const rect1, const rect2) : Rectangle [show]

Returns the intersection of two rectangles.

Parameters:
rect1 : Rectangle
rect2 : Rectangle
Returns:
Rectangle :
Signatures by Language:
C/C++: rectangle intersection(const rectangle *rect1, const rectangle *rect2);
C/C++: rectangle intersection_byval(const rectangle rect1, const rectangle rect2);
C++: rectangle intersection(const rectangle &rect1, const rectangle &rect2);
Pascal: function Intersection(const rect1: Rectangle; const rect2: Rectangle): Rectangle;

### Invert Vector

Returns a new Vector that is an inverted version of the parameter vector (v). In other words, the -/+ sign of the x and y values are changed.

• Invert Vector (const v) : Vector [show]

Returns a new Vector that is an inverted version of the parameter vector (v). In other words, the -/+ sign of the x and y values are changed.

Parameters:
v : Vector
Returns:
Vector :
Signatures by Language:
C/C++: vector invert_vector(const vector *v);
C/C++: vector invert_vector_byval(const vector v);
C++: vector invert_vector(const vector &v);
Pascal: function InvertVector(const v: Vector): Vector;

### Limit Vector

Returns a new Vector that is a based on the parameter v however its magnitude (length) will be limited (truncated) if it exceeds the specified limit value.

• Limit Vector (const v, limit) : Vector [show]

Returns a new Vector that is a based on the parameter v however its magnitude (length) will be limited (truncated) if it exceeds the specified limit value.

Parameters:
v : Vector
limit : Single
Returns:
Vector :
Signatures by Language:
C/C++: vector limit_vector(const vector *v, float limit);
C/C++: vector limit_vector_byval(const vector v, float limit);
C++: vector limit_vector(const vector &v, float limit);
Pascal: function LimitVector(const v: Vector; limit: Single): Vector;

### Line As Vector

Returns a new Vector created from the start and end points of a LineSegment. Useful for calculating angle vectors or extracting a normal vector (see LineNormal) for the line.

• Line As Vector (const line) : Vector [show]

Returns a new Vector created from the start and end points of a LineSegment. Useful for calculating angle vectors or extracting a normal vector (see LineNormal) for the line.

Parameters:
line : LineSegment
Returns:
Vector :
Signatures by Language:
C/C++: vector line_as_vector(const line_segment *line);
C/C++: vector line_as_vector_byval(const line_segment line);
C++: vector line_as_vector(const line_segment &line);
Pascal: function LineAsVector(const line: LineSegment): Vector;

### Line Circle Hit

Which of the lines from the array of line segments did the circle collide with given the indicated velocity.

• Line Circle Hit (const c, const velocity, const lines, out found) : Boolean [show]

Which of the lines from the array of line segments did the circle collide with given the indicated velocity.

Parameters:
c : Circle
velocity : Vector
lines : LinesArray
found : LineSegment
Returns:
Boolean :
Signatures by Language:
C/C++: bool line_circle_hit(const circle *c, const vector *velocity, const lines_array lines, line_segment *found, int32_t lines_len);
C/C++: bool line_circle_hit_byval(const circle c, const vector velocity, const lines_array lines, line_segment *found, int32_t lines_len);
C++: bool line_circle_hit(const circle &c, const vector &velocity, const lines_array lines, line_segment &found, int32_t lines_len);
Pascal: function LineCircleHit(const c: Circle; const velocity: Vector; const lines: LinesArray; out found: LineSegment): Boolean;

### Line From

Returns a line segment from x1,y1 to x2,y2.

• Line From (x1, y1, x2, y2) : LineSegment [show]

Returns a line segment from x1,y1 to x2,y2.

Parameters:
x1 : Single
y1 : Single
x2 : Single
y2 : Single
Returns:
LineSegment :
Signatures by Language:
C/C++: line_segment line_from(float x1, float y1, float x2, float y2);
Pascal: function LineFrom(x1: Single; y1: Single; x2: Single; y2: Single): LineSegment;
• Line From (const pt1, const pt2) : LineSegment [show]

Returns a line from pt1 to pt2.

Parameters:
pt1 : Point2D
pt2 : Point2D
Returns:
LineSegment :
Signatures by Language:
C/C++: line_segment line_from_point_to_point(const point2d *pt1, const point2d *pt2);
C/C++: line_segment line_from_point_to_point_byval(const point2d pt1, const point2d pt2);
C++: line_segment line_from(const point2d &pt1, const point2d &pt2);
Pascal: function LineFrom(const pt1: Point2D; const pt2: Point2D): LineSegment;

### Line From Vector

Returns a line from the origin to the end of the mv vector.

• Line From Vector (const mv) : LineSegment [show]

Returns a line from the origin to the end of the mv vector.

Parameters:
mv : Vector
Returns:
LineSegment :
Signatures by Language:
C/C++: line_segment line_from_vector(const vector *mv);
C/C++: line_segment line_from_vector_byval(const vector mv);
C++: line_segment line_from_vector(const vector &mv);
Pascal: function LineFromVector(const mv: Vector): LineSegment;
• Line From Vector (const pt, const mv) : LineSegment [show]

Returns a line from a starting point to the point at the end of the mv vector.

Parameters:
pt : Point2D
mv : Vector
Returns:
LineSegment :
Signatures by Language:
C/C++: line_segment line_from_vector_with_start_point(const point2d *pt, const vector *mv);
C/C++: line_segment line_from_vector_with_start_point_byval(const point2d pt, const vector mv);
C++: line_segment line_from_vector(const point2d &pt, const vector &mv);
Pascal: function LineFromVector(const pt: Point2D; const mv: Vector): LineSegment;
• Line From Vector (x, y, const mv) : LineSegment [show]

Returns a line from the x,y starting point to the point at the end of the mv vector.

Parameters:
x : Single
y : Single
mv : Vector
Returns:
LineSegment :
Signatures by Language:
C/C++: line_segment line_from_vector_with_start_xy(float x, float y, const vector *mv);
C/C++: line_segment line_from_vector_with_start_xy_byval(float x, float y, const vector mv);
C++: line_segment line_from_vector(float x, float y, const vector &mv);
Pascal: function LineFromVector(x: Single; y: Single; const mv: Vector): LineSegment;

### Line Intersection Point

Returns the intersection point of two lines.

• Line Intersection Point (const line1, const line2, out pt) : Boolean [show]

Returns the intersection point of two lines.

Parameters:
line1 : LineSegment
line2 : LineSegment
pt : Point2D
Returns:
Boolean :
Signatures by Language:
C/C++: bool line_intersection_point(const line_segment *line1, const line_segment *line2, point2d *pt);
C/C++: bool line_intersection_point_byval(const line_segment line1, const line_segment line2, point2d *pt);
C++: bool line_intersection_point(const line_segment &line1, const line_segment &line2, point2d &pt);
Pascal: function LineIntersectionPoint(const line1: LineSegment; const line2: LineSegment; out pt: Point2D): Boolean;

### Line Intersects Circle

Returns true if the line segment intersects the circle.

• Line Intersects Circle (const l, const c) : Boolean [show]

Returns true if the line segment intersects the circle.

Parameters:
l : LineSegment
c : Circle
Returns:
Boolean :
Signatures by Language:
C/C++: bool line_intersects_circle(const line_segment *l, const circle *c);
C/C++: bool line_intersects_circle_byval(const line_segment l, const circle c);
C++: bool line_intersects_circle(const line_segment &l, const circle &c);
Pascal: function LineIntersectsCircle(const l: LineSegment; const c: Circle): Boolean;

### Line Intersects Lines

Returns true if the line intersect any of the lines in the array.

• Line Intersects Lines (const line, const lines) : Boolean [show]

Returns true if the line intersect any of the lines in the array.

Parameters:
line : LineSegment
lines : LinesArray
Returns:
Boolean :
Signatures by Language:
C/C++: bool line_intersects_lines(const line_segment *line, const lines_array lines, int32_t lines_len);
C/C++: bool line_intersects_lines_byval(const line_segment line, const lines_array lines, int32_t lines_len);
C++: bool line_intersects_lines(const line_segment &line, const lines_array lines, int32_t lines_len);
Pascal: function LineIntersectsLines(const line: LineSegment; const lines: LinesArray): Boolean;

### Line Intersects Rect

Returns true if the line intersects the rectangle.

• Line Intersects Rect (const line, const rect) : Boolean [show]

Returns true if the line intersects the rectangle.

Parameters:
line : LineSegment
rect : Rectangle
Returns:
Boolean :
Signatures by Language:
C/C++: bool line_intersects_rect(const line_segment *line, const rectangle *rect);
C/C++: bool line_intersects_rect_byval(const line_segment line, const rectangle rect);
C++: bool line_intersects_rect(const line_segment &line, const rectangle &rect);
Pascal: function LineIntersectsRect(const line: LineSegment; const rect: Rectangle): Boolean;

### Line Magnitude Sq

Returns the squared line magnitude.

• Line Magnitude Sq (const line) : Single [show]

Returns the squared line magnitude.

Parameters:
line : LineSegment
Returns:
Single :
Signatures by Language:
C/C++: float line_magnitude_sq_from_line(const line_segment *line);
C/C++: float line_magnitude_sq_from_line_byval(const line_segment line);
C++: float line_magnitude_sq(const line_segment &line);
Pascal: function LineMagnitudeSq(const line: LineSegment): Single;
• Line Magnitude Sq (x1, y1, x2, y2) : Single [show]

Returns the squared magnitude of the line from the points given.

Parameters:
x1 : Single
y1 : Single
x2 : Single
y2 : Single
Returns:
Single :
Signatures by Language:
C/C++: float line_magnitude_sq(float x1, float y1, float x2, float y2);
Pascal: function LineMagnitudeSq(x1: Single; y1: Single; x2: Single; y2: Single): Single;

### Line Mid Point

Returns the mid point of the line segment.

• Line Mid Point (const line) : Point2D [show]

Returns the mid point of the line segment.

Parameters:
line : LineSegment
Returns:
Point2D :
Signatures by Language:
C/C++: point2d line_mid_point(const line_segment *line);
C/C++: point2d line_mid_point_byval(const line_segment line);
C++: point2d line_mid_point(const line_segment &line);
Pascal: function LineMidPoint(const line: LineSegment): Point2D;

### Line Normal

Returns a unit vector (length is 1.0) that is "normal" (prependicular) to the line parameter. A normal vector is useful for calculating the result of a collision such as sprites bouncing off walls (lines).

• Line Normal (const line) : Vector [show]

Returns a unit vector (length is 1.0) that is "normal" (prependicular) to the line parameter. A normal vector is useful for calculating the result of a collision such as sprites bouncing off walls (lines).

Parameters:
line : LineSegment
Returns:
Vector :
Signatures by Language:
C/C++: vector line_normal(const line_segment *line);
C/C++: vector line_normal_byval(const line_segment line);
C++: vector line_normal(const line_segment &line);
Pascal: function LineNormal(const line: LineSegment): Vector;

### Line Segments Intersect

Returns true if the two line segments intersect.

• Line Segments Intersect (const line1, const line2) : Boolean [show]

Returns true if the two line segments intersect.

Parameters:
line1 : LineSegment
line2 : LineSegment
Returns:
Boolean :
Signatures by Language:
C/C++: bool line_segments_intersect(const line_segment *line1, const line_segment *line2);
C/C++: bool line_segments_intersect_byval(const line_segment line1, const line_segment line2);
C++: bool line_segments_intersect(const line_segment &line1, const line_segment &line2);
Pascal: function LineSegmentsIntersect(const line1: LineSegment; const line2: LineSegment): Boolean;

### Line To String

Get a text description of the line segment.

• Line To String (const ln) : String [show]

Get a text description of the line segment.

Parameters:
ln : LineSegment
Returns:
String :
Signatures by Language:
C/C++: void line_to_string(const line_segment *ln, char *result);
C/C++: void line_to_string_byval(const line_segment ln, char *result);
C++: void line_to_string(const line_segment &ln, char *result);
Pascal: function LineToString(const ln: LineSegment): String;

### Lines From

Returns an array containing the four lines of the rectangle.

• Lines From (const rect) : LinesArray [show]

Returns an array containing the four lines of the rectangle.

Parameters:
rect : Rectangle
Returns:
LinesArray :
Signatures by Language:
C/C++: void lines_from_rect(const rectangle *rect, lines_array result, int32_t result_len);
C/C++: void lines_from_rect_byval(const rectangle rect, lines_array result, int32_t result_len);
C++: void lines_from(const rectangle &rect, lines_array result, int32_t result_len);
Pascal: function LinesFrom(const rect: Rectangle): LinesArray;
• Lines From (const tri) : LinesArray [show]

Returns an array containing the three lines from the triangle.

Parameters:
tri : Triangle
Returns:
LinesArray :
Signatures by Language:
C/C++: void lines_from_triangle(const triangle *tri, lines_array result, int32_t result_len);
C/C++: void lines_from_triangle_byval(const triangle tri, lines_array result, int32_t result_len);
C++: void lines_from(const triangle &tri, lines_array result, int32_t result_len);
Pascal: function LinesFrom(const tri: Triangle): LinesArray;

### Lines Rect Intersect

Returns true if any of the lines in the array intersect with the Rectangle index.php/api/r.

• Lines Rect Intersect (const lines, const r) : Boolean [show]

Returns true if any of the lines in the array intersect with the Rectangle index.php/api/r.

Parameters:
lines : LinesArray
r : Rectangle
Returns:
Boolean :
Signatures by Language:
C/C++: bool lines_rect_intersect(const lines_array lines, const rectangle *r, int32_t lines_len);
C/C++: bool lines_rect_intersect_byval(const lines_array lines, const rectangle r, int32_t lines_len);
C++: bool lines_rect_intersect(const lines_array lines, const rectangle &r, int32_t lines_len);
Pascal: function LinesRectIntersect(const lines: LinesArray; const r: Rectangle): Boolean;

### Matrix Multiply

Multiplies the Vector parameter v with the Matrix2D m and returns the result as a Vector. Use this to transform the vector with the matrix (to apply scaling, rotation or translation effects).

• Matrix Multiply (const m, const v) : Vector [show]

Multiplies the Vector parameter v with the Matrix2D m and returns the result as a Vector. Use this to transform the vector with the matrix (to apply scaling, rotation or translation effects).

Parameters:
m : Matrix2D
v : Vector
Returns:
Vector :
Signatures by Language:
C/C++: vector matrix_multiply_vector(const matrix2d *m, const vector *v);
C/C++: vector matrix_multiply_vector_byval(const matrix2d m, const vector v);
C++: vector matrix_multiply(const matrix2d &m, const vector &v);
Pascal: function MatrixMultiply(const m: Matrix2D; const v: Vector): Vector;
• Matrix Multiply (const m1, const m2) : Matrix2D [show]

Multiplies the two Matrix2D parameters, m1 by m2, and returns the result as a new Matrix2D. Use this to combine the effects to two matrix transformations.

Parameters:
m1 : Matrix2D
m2 : Matrix2D
Returns:
Matrix2D :
Signatures by Language:
C/C++: matrix2d matrix_multiply(const matrix2d *m1, const matrix2d *m2);
C/C++: matrix2d matrix_multiply_byval(const matrix2d m1, const matrix2d m2);
C++: matrix2d matrix_multiply(const matrix2d &m1, const matrix2d &m2);
Pascal: function MatrixMultiply(const m1: Matrix2D; const m2: Matrix2D): Matrix2D;

### Matrix To String

This function returns a string representation of a Matrix.

• Matrix To String (const m) : String [show]

This function returns a string representation of a Matrix.

Parameters:
m : Matrix2D
Returns:
String :
Signatures by Language:
C/C++: void matrix_to_string(const matrix2d *m, char *result);
C/C++: void matrix_to_string_byval(const matrix2d m, char *result);
C++: void matrix_to_string(const matrix2d &m, char *result);
Pascal: function MatrixToString(const m: Matrix2D): String;

Returns the sum of pt1 and pt2

• Point Add (const pt1, const pt2) : Point2D [show]

Returns the sum of pt1 and pt2

Parameters:
pt1 : Point2D
pt2 : Point2D
Returns:
Point2D :
Signatures by Language:
C/C++: point2d point_add(const point2d *pt1, const point2d *pt2);
C/C++: point2d point_add_byval(const point2d pt1, const point2d pt2);
C++: point2d point_add(const point2d &pt1, const point2d &pt2);
Pascal: function PointAdd(const pt1: Point2D; const pt2: Point2D): Point2D;

### Point At

Create a Point2D that points at the X,Y location passed in.

• Point At (x, y) : Point2D [show]

Create a Point2D that points at the X,Y location passed in.

Parameters:
x : Single
y : Single
Returns:
Point2D :
Signatures by Language:
C/C++: point2d point_at(float x, float y);
Pascal: function PointAt(x: Single; y: Single): Point2D;
• Point At (const startPoint, const offset) : Point2D [show]

Create a Point2D that points at the point from the startPoint at the end of the offset vector.

Parameters:
startPoint : Point2D
offset : Vector
Returns:
Point2D :
Signatures by Language:
C/C++: point2d point_at_start_with_offset(const point2d *startPoint, const vector *offset);
C/C++: point2d point_at_start_with_offset_byval(const point2d startPoint, const vector offset);
C++: point2d point_at(const point2d &startPoint, const vector &offset);
Pascal: function PointAt(const startPoint: Point2D; const offset: Vector): Point2D;

### Point In Circle

Returns True if the point pt is in the circle.

• Point In Circle (const pt, const c) : Boolean [show]

Returns True if the point pt is in the circle.

Parameters:
pt : Point2D
c : Circle
Returns:
Boolean :
Signatures by Language:
C/C++: bool point_in_circle(const point2d *pt, const circle *c);
C/C++: bool point_in_circle_byval(const point2d pt, const circle c);
C++: bool point_in_circle(const point2d &pt, const circle &c);
Pascal: function PointInCircle(const pt: Point2D; const c: Circle): Boolean;
• Point In Circle (const pt, x, y, radius) : Boolean [show]

Returns True if the point pt is in the circle defined by x, y, radius.

Parameters:
pt : Point2D
x : Single
y : Single
Returns:
Boolean :
Signatures by Language:
C/C++: bool point_in_circle_pt(const point2d *pt, float x, float y, float radius);
C/C++: bool point_in_circle_pt_byval(const point2d pt, float x, float y, float radius);
C++: bool point_in_circle(const point2d &pt, float x, float y, float radius);
Pascal: function PointInCircle(const pt: Point2D; x: Single; y: Single; radius: Single): Boolean;
• Point In Circle (ptX, ptY, cX, cY, radius) : Boolean [show]

Returns True if the point ptX, ptY is in the circle.

Parameters:
ptX : Single
ptY : Single
cX : Single
cY : Single
Returns:
Boolean :
Signatures by Language:
C/C++: bool point_xyin_circle(float ptX, float ptY, float cX, float cY, float radius);
C++: bool point_in_circle(float ptX, float ptY, float cX, float cY, float radius);
Pascal: function PointInCircle(ptX: Single; ptY: Single; cX: Single; cY: Single; radius: Single): Boolean;

### Point In Rect

Returns True if point pt is in the Rectangle rect.

• Point In Rect (const pt, const rect) : Boolean [show]

Returns True if point pt is in the Rectangle rect.

Parameters:
pt : Point2D
rect : Rectangle
Returns:
Boolean :
Signatures by Language:
C/C++: bool point_in_rect(const point2d *pt, const rectangle *rect);
C/C++: bool point_in_rect_byval(const point2d pt, const rectangle rect);
C++: bool point_in_rect(const point2d &pt, const rectangle &rect);
Pascal: function PointInRect(const pt: Point2D; const rect: Rectangle): Boolean;
• Point In Rect (x, y, const rect) : Boolean [show]

Returns true if the x,y point is within the rectangle.

Parameters:
x : Single
y : Single
rect : Rectangle
Returns:
Boolean :
Signatures by Language:
C/C++: bool point_xyin_rect(float x, float y, const rectangle *rect);
C/C++: bool point_xyin_rect_byval(float x, float y, const rectangle rect);
C++: bool point_in_rect(float x, float y, const rectangle &rect);
Pascal: function PointInRect(x: Single; y: Single; const rect: Rectangle): Boolean;
• Point In Rect (const pt, x, y, w, h) : Boolean [show]

Returns true if the point is within the rectangle.

Parameters:
pt : Point2D
x : Single
y : Single
w : Single
h : Single
Returns:
Boolean :
Signatures by Language:
C/C++: bool point_in_rect_xy(const point2d *pt, float x, float y, float w, float h);
C/C++: bool point_in_rect_xy_byval(const point2d pt, float x, float y, float w, float h);
C++: bool point_in_rect(const point2d &pt, float x, float y, float w, float h);
Pascal: function PointInRect(const pt: Point2D; x: Single; y: Single; w: Single; h: Single): Boolean;
• Point In Rect (ptX, ptY, x, y, w, h) : Boolean [show]

Returns true if the point (ptX, ptY) is within the rectangle.

Parameters:
ptX : Single
ptY : Single
x : Single
y : Single
w : Single
h : Single
Returns:
Boolean :
Signatures by Language:
C/C++: bool point_xyin_rect_xy(float ptX, float ptY, float x, float y, float w, float h);
C++: bool point_in_rect(float ptX, float ptY, float x, float y, float w, float h);
Pascal: function PointInRect(ptX: Single; ptY: Single; x: Single; y: Single; w: Single; h: Single): Boolean;

### Point In Triangle

Returns true if the point pt is in the Triangle tri.

• Point In Triangle (const pt, const tri) : Boolean [show]

Returns true if the point pt is in the Triangle tri.

Parameters:
pt : Point2D
tri : Triangle
Returns:
Boolean :
Signatures by Language:
C/C++: bool point_in_triangle(const point2d *pt, const triangle *tri);
C/C++: bool point_in_triangle_byval(const point2d pt, const triangle tri);
C++: bool point_in_triangle(const point2d &pt, const triangle &tri);
Pascal: function PointInTriangle(const pt: Point2D; const tri: Triangle): Boolean;

### Point Line Distance

Returns the distance from the x,y point to the line segment.

• Point Line Distance (x, y, const line) : Single [show]

Returns the distance from the x,y point to the line segment.

Parameters:
x : Single
y : Single
line : LineSegment
Returns:
Single :
Signatures by Language:
C/C++: float point_xyline_distance(float x, float y, const line_segment *line);
C/C++: float point_xyline_distance_byval(float x, float y, const line_segment line);
C++: float point_line_distance(float x, float y, const line_segment &line);
Pascal: function PointLineDistance(x: Single; y: Single; const line: LineSegment): Single;
• Point Line Distance (const pt, const line) : Single [show]

Returns distance from the line, or if the intersecting point on the line nearest the point tested is outside the endpoints of the line, the distance to the nearest endpoint.

Returns -1 on zero-valued denominator conditions to return an illegal distance. ( modification of Brandon Crosby's VBA code)

Parameters:
pt : Point2D
line : LineSegment
Returns:
Single :
Signatures by Language:
C/C++: float point_line_distance(const point2d *pt, const line_segment *line);
C/C++: float point_line_distance_byval(const point2d pt, const line_segment line);
C++: float point_line_distance(const point2d &pt, const line_segment &line);
Pascal: function PointLineDistance(const pt: Point2D; const line: LineSegment): Single;

### Point On Line

Returns True if point pt is on the line segment line.

• Point On Line (const pt, const line) : Boolean [show]

Returns True if point pt is on the line segment line.

Parameters:
pt : Point2D
line : LineSegment
Returns:
Boolean :
Signatures by Language:
C/C++: bool point_on_line(const point2d *pt, const line_segment *line);
C/C++: bool point_on_line_byval(const point2d pt, const line_segment line);
C++: bool point_on_line(const point2d &pt, const line_segment &line);
Pascal: function PointOnLine(const pt: Point2D; const line: LineSegment): Boolean;
• Point On Line (const pt, x, y, endX, endY) : Boolean [show]

Returns True if point pt is on the line segment line.

Parameters:
pt : Point2D
x : Single
y : Single
endX : Single
endY : Single
Returns:
Boolean :
Signatures by Language:
C/C++: bool point_on_line_xyxy(const point2d *pt, float x, float y, float endX, float endY);
C/C++: bool point_on_line_xyxy_byval(const point2d pt, float x, float y, float endX, float endY);
C++: bool point_on_line(const point2d &pt, float x, float y, float endX, float endY);
Pascal: function PointOnLine(const pt: Point2D; x: Single; y: Single; endX: Single; endY: Single): Boolean;

### Point On Point

Returns True of index.php/api/pt1 is at the same point as index.php/api/pt2.

• Point On Point (const pt1, const pt2) : Boolean [show]

Returns True of index.php/api/pt1 is at the same point as index.php/api/pt2.

Parameters:
pt1 : Point2D
pt2 : Point2D
Returns:
Boolean :
Signatures by Language:
C/C++: bool point_on_point(const point2d *pt1, const point2d *pt2);
C/C++: bool point_on_point_byval(const point2d pt1, const point2d pt2);
C++: bool point_on_point(const point2d &pt1, const point2d &pt2);
Pascal: function PointOnPoint(const pt1: Point2D; const pt2: Point2D): Boolean;

### Point Point Distance

Returns the distance from point to point.

• Point Point Distance (const pt1, const pt2) : Single [show]

Returns the distance from point to point.

Parameters:
pt1 : Point2D
pt2 : Point2D
Returns:
Single :
Signatures by Language:
C/C++: float point_point_distance(const point2d *pt1, const point2d *pt2);
C/C++: float point_point_distance_byval(const point2d pt1, const point2d pt2);
C++: float point_point_distance(const point2d &pt1, const point2d &pt2);
Pascal: function PointPointDistance(const pt1: Point2D; const pt2: Point2D): Single;

### Point To String

Get a text description of the point2D.

• Point To String (const pt) : String [show]

Get a text description of the point2D.

Parameters:
pt : Point2D
Returns:
String :
Signatures by Language:
C/C++: void point_to_string(const point2d *pt, char *result);
C/C++: void point_to_string_byval(const point2d pt, char *result);
C++: void point_to_string(const point2d &pt, char *result);
Pascal: function PointToString(const pt: Point2D): String;

### Points From

Returns the four points from the corners of a rectangle.

• Points From (const rect) : Point2DArray [show]

Returns the four points from the corners of a rectangle.

Parameters:
rect : Rectangle
Returns:
Point2DArray :
Signatures by Language:
C/C++: void points_from_rect(const rectangle *rect, point2d *result, int32_t result_len);
C/C++: void points_from_rect_byval(const rectangle rect, point2d *result, int32_t result_len);
C++: void points_from(const rectangle &rect, point2d *result, int32_t result_len);
Pascal: function PointsFrom(const rect: Rectangle): Point2DArray;
• Points From (const line) : Point2DArray [show]

Returns the two points from the ends of a line segment.

Parameters:
line : LineSegment
Returns:
Point2DArray :
Signatures by Language:
C/C++: void points_from_line(const line_segment *line, point2d *result, int32_t result_len);
C/C++: void points_from_line_byval(const line_segment line, point2d *result, int32_t result_len);
C++: void points_from(const line_segment &line, point2d *result, int32_t result_len);
Pascal: function PointsFrom(const line: LineSegment): Point2DArray;

### Random Screen Point

Create a Point2D that points at the X,Y location passed in.

• Random Screen Point () : Point2D [show]

Create a Point2D that points at the X,Y location passed in.

Returns:
Point2D :
Signatures by Language:
C/C++: point2d random_screen_point();
Pascal: function RandomScreenPoint(): Point2D;

### Ray Circle Intersect Distance

Returns the distance from the ray origin to the edge of the circle where the ray heads in the direction indicated in the ray_heading parameter. This returns -1 where the ray does not hit the circle.

• Ray Circle Intersect Distance (const ray_origin, const ray_heading, const c) : Single [show]

Returns the distance from the ray origin to the edge of the circle where the ray heads in the direction indicated in the ray_heading parameter. This returns -1 where the ray does not hit the circle.

Parameters:
ray_origin : Point2D
c : Circle
Returns:
Single :
Signatures by Language:
C/C++: float ray_circle_intersect_distance(const point2d *ray_origin, const vector *ray_heading, const circle *c);
C/C++: float ray_circle_intersect_distance_byval(const point2d ray_origin, const vector ray_heading, const circle c);
C++: float ray_circle_intersect_distance(const point2d &ray_origin, const vector &ray_heading, const circle &c);
Pascal: function RayCircleIntersectDistance(const ray_origin: Point2D; const ray_heading: Vector; const c: Circle): Single;

### Ray Intersection Point

Returns the intersection point of a ray with a line, returning true if the ray intesects with the line.

• Ray Intersection Point (const fromPt, const heading, const line, out pt) : Boolean [show]

Returns the intersection point of a ray with a line, returning true if the ray intesects with the line.

Parameters:
fromPt : Point2D
line : LineSegment
pt : Point2D
Returns:
Boolean :
Signatures by Language:
C/C++: bool ray_intersection_point(const point2d *fromPt, const vector *heading, const line_segment *line, point2d *pt);
C/C++: bool ray_intersection_point_byval(const point2d fromPt, const vector heading, const line_segment line, point2d *pt);
C++: bool ray_intersection_point(const point2d &fromPt, const vector &heading, const line_segment &line, point2d &pt);
Pascal: function RayIntersectionPoint(const fromPt: Point2D; const heading: Vector; const line: LineSegment; out pt: Point2D): Boolean;

### Rectangle After Move

Returns the rectangle details after it moved the amount specified within the vector.

• Rectangle After Move (const rect, const mv) : Rectangle [show]

Returns the rectangle details after it moved the amount specified within the vector.

Parameters:
rect : Rectangle
mv : Vector
Returns:
Rectangle :
Signatures by Language:
C/C++: rectangle rectangle_after_move(const rectangle *rect, const vector *mv);
C/C++: rectangle rectangle_after_move_byval(const rectangle rect, const vector mv);
C++: rectangle rectangle_after_move(const rectangle &rect, const vector &mv);
Pascal: function RectangleAfterMove(const rect: Rectangle; const mv: Vector): Rectangle;

### Rectangle Bottom

Returns the bottom (y) value of a rectangle.

• Rectangle Bottom (const rect) : Single [show]

Returns the bottom (y) value of a rectangle.

Parameters:
rect : Rectangle
Returns:
Single :
Signatures by Language:
C/C++: float rectangle_bottom(const rectangle *rect);
C/C++: float rectangle_bottom_byval(const rectangle rect);
C++: float rectangle_bottom(const rectangle &rect);
Pascal: function RectangleBottom(const rect: Rectangle): Single;

### Rectangle Bottom Left

Returns the bottom left corner of the rectangle.

• Rectangle Bottom Left (const rect) : Point2D [show]

Returns the bottom left corner of the rectangle.

Parameters:
rect : Rectangle
Returns:
Point2D :
Signatures by Language:
C/C++: point2d rectangle_bottom_left(const rectangle *rect);
C/C++: point2d rectangle_bottom_left_byval(const rectangle rect);
C++: point2d rectangle_bottom_left(const rectangle &rect);
Pascal: function RectangleBottomLeft(const rect: Rectangle): Point2D;

### Rectangle Bottom Right

Returns the bottom right corner of the rectangle.

• Rectangle Bottom Right (const rect) : Point2D [show]

Returns the bottom right corner of the rectangle.

Parameters:
rect : Rectangle
Returns:
Point2D :
Signatures by Language:
C/C++: point2d rectangle_bottom_right(const rectangle *rect);
C/C++: point2d rectangle_bottom_right_byval(const rectangle rect);
C++: point2d rectangle_bottom_right(const rectangle &rect);
Pascal: function RectangleBottomRight(const rect: Rectangle): Point2D;

### Rectangle Center

Returns the center point of the rectangle.

• Rectangle Center (const rect) : Point2D [show]

Returns the center point of the rectangle.

Parameters:
rect : Rectangle
Returns:
Point2D :
Signatures by Language:
C/C++: point2d rectangle_center(const rectangle *rect);
C/C++: point2d rectangle_center_byval(const rectangle rect);
C++: point2d rectangle_center(const rectangle &rect);
Pascal: function RectangleCenter(const rect: Rectangle): Point2D;

### Rectangle Center Bottom

Returns the center of the bottom line of the rectangle.

• Rectangle Center Bottom (const rect) : Point2D [show]

Returns the center of the bottom line of the rectangle.

Parameters:
rect : Rectangle
Returns:
Point2D :
Signatures by Language:
C/C++: point2d rectangle_center_bottom(const rectangle *rect);
C/C++: point2d rectangle_center_bottom_byval(const rectangle rect);
C++: point2d rectangle_center_bottom(const rectangle &rect);
Pascal: function RectangleCenterBottom(const rect: Rectangle): Point2D;

### Rectangle Center Left

Returns the center of the left line of the rectangle.

• Rectangle Center Left (const rect) : Point2D [show]

Returns the center of the left line of the rectangle.

Parameters:
rect : Rectangle
Returns:
Point2D :
Signatures by Language:
C/C++: point2d rectangle_center_left(const rectangle *rect);
C/C++: point2d rectangle_center_left_byval(const rectangle rect);
C++: point2d rectangle_center_left(const rectangle &rect);
Pascal: function RectangleCenterLeft(const rect: Rectangle): Point2D;

### Rectangle Center Right

Returns the center of the right line of the rectangle.

• Rectangle Center Right (const rect) : Point2D [show]

Returns the center of the right line of the rectangle.

Parameters:
rect : Rectangle
Returns:
Point2D :
Signatures by Language:
C/C++: point2d rectangle_center_right(const rectangle *rect);
C/C++: point2d rectangle_center_right_byval(const rectangle rect);
C++: point2d rectangle_center_right(const rectangle &rect);
Pascal: function RectangleCenterRight(const rect: Rectangle): Point2D;

### Rectangle Center Top

Returns the center of the top line of the rectangle.

• Rectangle Center Top (const rect) : Point2D [show]

Returns the center of the top line of the rectangle.

Parameters:
rect : Rectangle
Returns:
Point2D :
Signatures by Language:
C/C++: point2d rectangle_center_top(const rectangle *rect);
C/C++: point2d rectangle_center_top_byval(const rectangle rect);
C++: point2d rectangle_center_top(const rectangle &rect);
Pascal: function RectangleCenterTop(const rect: Rectangle): Point2D;

### Rectangle From

Returns a rectangle from a given x,y location with a given width and height.

• Rectangle From (x, y, w, h) : Rectangle [show]

Returns a rectangle from a given x,y location with a given width and height.

Parameters:
x : Single
y : Single
w : Longint
h : Longint
Returns:
Rectangle :
Signatures by Language:
C/C++: rectangle rectangle_from(float x, float y, int32_t w, int32_t h);
Pascal: function RectangleFrom(x: Single; y: Single; w: Longint; h: Longint): Rectangle;
• Rectangle From (const tri) : Rectangle [show]

Returns a rectangle that encloses th epoints in a triangle.

Parameters:
tri : Triangle
Returns:
Rectangle :
Signatures by Language:
C/C++: rectangle rectangle_from_triangle(const triangle *tri);
C/C++: rectangle rectangle_from_triangle_byval(const triangle tri);
C++: rectangle rectangle_from(const triangle &tri);
Pascal: function RectangleFrom(const tri: Triangle): Rectangle;
• Rectangle From (const lines) : Rectangle [show]

Returns a rectangle that encloses the lines in the lines array.

Parameters:
lines : LinesArray
Returns:
Rectangle :
Signatures by Language:
C/C++: rectangle rectangle_from_lines(const lines_array lines, int32_t lines_len);
C++: rectangle rectangle_from(const lines_array lines, int32_t lines_len);
Pascal: function RectangleFrom(const lines: LinesArray): Rectangle;
• Rectangle From (const line) : Rectangle [show]

Returns a rectangle that encloses the two points on the line segment.

Parameters:
line : LineSegment
Returns:
Rectangle :
Signatures by Language:
C/C++: rectangle rectangle_from_line(const line_segment *line);
C/C++: rectangle rectangle_from_line_byval(const line_segment line);
C++: rectangle rectangle_from(const line_segment &line);
Pascal: function RectangleFrom(const line: LineSegment): Rectangle;
• Rectangle From (const c) : Rectangle [show]

Returns a rectangle that encloses a circle.

Parameters:
c : Circle
Returns:
Rectangle :
Signatures by Language:
C/C++: rectangle rectangle_from_circle(const circle *c);
C/C++: rectangle rectangle_from_circle_byval(const circle c);
C++: rectangle rectangle_from(const circle &c);
Pascal: function RectangleFrom(const c: Circle): Rectangle;
• Rectangle From (const pt1, const pt2) : Rectangle [show]

Returns a rectangle with pt1 and pt2 defining the two distant edge points.

Parameters:
pt1 : Point2D
pt2 : Point2D
Returns:
Rectangle :
Signatures by Language:
C/C++: rectangle rectangle_for_points(const point2d *pt1, const point2d *pt2);
C/C++: rectangle rectangle_for_points_byval(const point2d pt1, const point2d pt2);
C++: rectangle rectangle_from(const point2d &pt1, const point2d &pt2);
Pascal: function RectangleFrom(const pt1: Point2D; const pt2: Point2D): Rectangle;
• Rectangle From (const pt, width, height) : Rectangle [show]

Returns a rectangle at a given point with a specified width and height.

Parameters:
pt : Point2D
width : Longint
height : Longint
Returns:
Rectangle :
Signatures by Language:
C/C++: rectangle rectangle_at_point(const point2d *pt, int32_t width, int32_t height);
C/C++: rectangle rectangle_at_point_byval(const point2d pt, int32_t width, int32_t height);
C++: rectangle rectangle_from(const point2d &pt, int32_t width, int32_t height);
Pascal: function RectangleFrom(const pt: Point2D; width: Longint; height: Longint): Rectangle;

### Rectangle Left

Returns the left (x) value of a rectangle.

• Rectangle Left (const rect) : Single [show]

Returns the left (x) value of a rectangle.

Parameters:
rect : Rectangle
Returns:
Single :
Signatures by Language:
C/C++: float rectangle_left(const rectangle *rect);
C/C++: float rectangle_left_byval(const rectangle rect);
C++: float rectangle_left(const rectangle &rect);
Pascal: function RectangleLeft(const rect: Rectangle): Single;

### Rectangle Offset

Returns a rectangle that is offset by the vector.

• Rectangle Offset (const rect, const vec) : Rectangle [show]

Returns a rectangle that is offset by the vector.

Parameters:
rect : Rectangle
vec : Vector
Returns:
Rectangle :
Signatures by Language:
C/C++: rectangle rectangle_offset(const rectangle *rect, const vector *vec);
C/C++: rectangle rectangle_offset_byval(const rectangle rect, const vector vec);
C++: rectangle rectangle_offset(const rectangle &rect, const vector &vec);
Pascal: function RectangleOffset(const rect: Rectangle; const vec: Vector): Rectangle;

### Rectangle Right

Returns the right (x) value of a rectangle.

• Rectangle Right (const rect) : Single [show]

Returns the right (x) value of a rectangle.

Parameters:
rect : Rectangle
Returns:
Single :
Signatures by Language:
C/C++: float rectangle_right(const rectangle *rect);
C/C++: float rectangle_right_byval(const rectangle rect);
C++: float rectangle_right(const rectangle &rect);
Pascal: function RectangleRight(const rect: Rectangle): Single;

### Rectangle To String

Get a text description of the rectangle.

• Rectangle To String (const rect) : String [show]

Get a text description of the rectangle.

Parameters:
rect : Rectangle
Returns:
String :
Signatures by Language:
C/C++: void rectangle_to_string(const rectangle *rect, char *result);
C/C++: void rectangle_to_string_byval(const rectangle rect, char *result);
C++: void rectangle_to_string(const rectangle &rect, char *result);
Pascal: function RectangleToString(const rect: Rectangle): String;

### Rectangle Top

Returns the top (y) value of a rectangle.

• Rectangle Top (const rect) : Single [show]

Returns the top (y) value of a rectangle.

Parameters:
rect : Rectangle
Returns:
Single :
Signatures by Language:
C/C++: float rectangle_top(const rectangle *rect);
C/C++: float rectangle_top_byval(const rectangle rect);
C++: float rectangle_top(const rectangle &rect);
Pascal: function RectangleTop(const rect: Rectangle): Single;

### Rectangle Top Left

Returns the top left corner of the rectangle.

• Rectangle Top Left (const rect) : Point2D [show]

Returns the top left corner of the rectangle.

Parameters:
rect : Rectangle
Returns:
Point2D :
Signatures by Language:
C/C++: point2d rectangle_top_left(const rectangle *rect);
C/C++: point2d rectangle_top_left_byval(const rectangle rect);
C++: point2d rectangle_top_left(const rectangle &rect);
Pascal: function RectangleTopLeft(const rect: Rectangle): Point2D;

### Rectangle Top Right

Returns the top right corner of the rectangle.

• Rectangle Top Right (const rect) : Point2D [show]

Returns the top right corner of the rectangle.

Parameters:
rect : Rectangle
Returns:
Point2D :
Signatures by Language:
C/C++: point2d rectangle_top_right(const rectangle *rect);
C/C++: point2d rectangle_top_right_byval(const rectangle rect);
C++: point2d rectangle_top_right(const rectangle &rect);
Pascal: function RectangleTopRight(const rect: Rectangle): Point2D;

### Rectangles Intersect

Returns true if the two rectangles intersect.

• Rectangles Intersect (const rect1, const rect2) : Boolean [show]

Returns true if the two rectangles intersect.

Parameters:
rect1 : Rectangle
rect2 : Rectangle
Returns:
Boolean :
Signatures by Language:
C/C++: bool rectangles_intersect(const rectangle *rect1, const rectangle *rect2);
C/C++: bool rectangles_intersect_byval(const rectangle rect1, const rectangle rect2);
C++: bool rectangles_intersect(const rectangle &rect1, const rectangle &rect2);
Pascal: function RectanglesIntersect(const rect1: Rectangle; const rect2: Rectangle): Boolean;

### Rotation Matrix

Returns a rotation matrix that rotates 2d points by the angle.

• Rotation Matrix (deg) : Matrix2D [show]

Returns a rotation matrix that rotates 2d points by the angle.

Parameters:
deg : Single
Returns:
Matrix2D :
Signatures by Language:
C/C++: matrix2d rotation_matrix(float deg);
Pascal: function RotationMatrix(deg: Single): Matrix2D;

### Scale Matrix

Returns a matrix that can be used to scale 2d points (both x and y).

• Scale Matrix (scale) : Matrix2D [show]

Returns a matrix that can be used to scale 2d points (both x and y).

Parameters:
scale : Single
Returns:
Matrix2D :
Signatures by Language:
C/C++: matrix2d scale_matrix(float scale);
Pascal: function ScaleMatrix(scale: Single): Matrix2D;
• Scale Matrix (const scale) : Matrix2D [show]

Create a scale matrix that scales x and y to different degrees.

Parameters:
scale : Point2D
Returns:
Matrix2D :
Signatures by Language:
C/C++: matrix2d scale_matrix_by_point(const point2d *scale);
C/C++: matrix2d scale_matrix_by_point_byval(const point2d scale);
C++: matrix2d scale_matrix(const point2d &scale);
Pascal: function ScaleMatrix(const scale: Point2D): Matrix2D;

### Scale Rotate Translate Matrix

Create a matrix that can scale, rotate then translate geometry points.

• Scale Rotate Translate Matrix (const scale, deg, const translate) : Matrix2D [show]

Create a matrix that can scale, rotate then translate geometry points.

Parameters:
scale : Point2D
deg : Single
translate : Point2D
Returns:
Matrix2D :
Signatures by Language:
C/C++: matrix2d scale_rotate_translate_matrix(const point2d *scale, float deg, const point2d *translate);
C/C++: matrix2d scale_rotate_translate_matrix_byval(const point2d scale, float deg, const point2d translate);
C++: matrix2d scale_rotate_translate_matrix(const point2d &scale, float deg, const point2d &translate);
Pascal: function ScaleRotateTranslateMatrix(const scale: Point2D; deg: Single; const translate: Point2D): Matrix2D;

### Sine

Returns the sine of the passed in angle (in degrees).

• Sine (angle) : Single [show]

Returns the sine of the passed in angle (in degrees).

Parameters:
angle : Single
Returns:
Single :
Signatures by Language:
C/C++: float sine(float angle);
Pascal: function Sine(angle: Single): Single;

### Subtract Vectors

Subtracts the second vector parameter (v2) from the first vector (v1) and returns the result as new Vector.

• Subtract Vectors (const v1, const v2) : Vector [show]

Subtracts the second vector parameter (v2) from the first vector (v1) and returns the result as new Vector.

Parameters:
v1 : Vector
v2 : Vector
Returns:
Vector :
Signatures by Language:
C/C++: vector subtract_vectors(const vector *v1, const vector *v2);
C/C++: vector subtract_vectors_byval(const vector v1, const vector v2);
C++: vector subtract_vectors(const vector &v1, const vector &v2);
Pascal: function SubtractVectors(const v1: Vector; const v2: Vector): Vector;

### Tangent

Returns the tangent of the passed in angle (in degrees).

• Tangent (angle) : Single [show]

Returns the tangent of the passed in angle (in degrees).

Parameters:
angle : Single
Returns:
Single :
Signatures by Language:
C/C++: float tangent(float angle);
Pascal: function Tangent(angle: Single): Single;

### Tangent Points

Returns the two tangent points on the circle given the indicated vector.

• Tangent Points (const fromPt, const c, out p1, out p2) : Boolean [show]

Returns the two tangent points on the circle given the indicated vector.

Parameters:
fromPt : Point2D
c : Circle
p1 : Point2D
p2 : Point2D
Returns:
Boolean :
Signatures by Language:
C/C++: bool tangent_points(const point2d *fromPt, const circle *c, point2d *p1, point2d *p2);
C/C++: bool tangent_points_byval(const point2d fromPt, const circle c, point2d *p1, point2d *p2);
C++: bool tangent_points(const point2d &fromPt, const circle &c, point2d &p1, point2d &p2);
Pascal: function TangentPoints(const fromPt: Point2D; const c: Circle; out p1: Point2D; out p2: Point2D): Boolean;

### Translation Matrix

Returns a matrix that can be used to translate 2d points. Moving them by dx and dy.

• Translation Matrix (dx, dy) : Matrix2D [show]

Returns a matrix that can be used to translate 2d points. Moving them by dx and dy.

Parameters:
dx : Single
dy : Single
Returns:
Matrix2D :
Signatures by Language:
C/C++: matrix2d translation_matrix(float dx, float dy);
Pascal: function TranslationMatrix(dx: Single; dy: Single): Matrix2D;
• Translation Matrix (const pt) : Matrix2D [show]

Returns a translation matric used to translate 2d points by the distance in the Point2D.

Parameters:
pt : Point2D
Returns:
Matrix2D :
Signatures by Language:
C/C++: matrix2d translation_matrix_pt(const point2d *pt);
C/C++: matrix2d translation_matrix_pt_byval(const point2d pt);
C++: matrix2d translation_matrix(const point2d &pt);
Pascal: function TranslationMatrix(const pt: Point2D): Matrix2D;

### Triangle Barycenter

Returns the barycenter point of the triangle.

• Triangle Barycenter (const tri) : Point2D [show]

Returns the barycenter point of the triangle.

Parameters:
tri : Triangle
Returns:
Point2D :
Signatures by Language:
C/C++: point2d triangle_barycenter(const triangle *tri);
C/C++: point2d triangle_barycenter_byval(const triangle tri);
C++: point2d triangle_barycenter(const triangle &tri);
Pascal: function TriangleBarycenter(const tri: Triangle): Point2D;

### Triangle From

Returns a triangle from the points passed in.

• Triangle From (ax, ay, bx, by, cx, cy) : Triangle [show]

Returns a triangle from the points passed in.

Parameters:
ax : Single
ay : Single
bx : Single
by : Single
cx : Single
cy : Single
Returns:
Triangle :
Signatures by Language:
C/C++: triangle triangle_from(float ax, float ay, float bx, float by, float cx, float cy);
Pascal: function TriangleFrom(ax: Single; ay: Single; bx: Single; by: Single; cx: Single; cy: Single): Triangle;
• Triangle From (const a, const b, const c) : Triangle [show]

Returns a triangle made up of the three points passed in.

Parameters:
a : Point2D
b : Point2D
c : Point2D
Returns:
Triangle :
Signatures by Language:
C/C++: triangle triangle_from_points(const point2d *a, const point2d *b, const point2d *c);
C/C++: triangle triangle_from_points_byval(const point2d a, const point2d b, const point2d c);
C++: triangle triangle_from(const point2d &a, const point2d &b, const point2d &c);
Pascal: function TriangleFrom(const a: Point2D; const b: Point2D; const c: Point2D): Triangle;

### Triangle Rectangle Intersect

Returns true if the triangle intersects with the rectangle.

• Triangle Rectangle Intersect (const tri, const rect) : Boolean [show]

Returns true if the triangle intersects with the rectangle.

Parameters:
tri : Triangle
rect : Rectangle
Returns:
Boolean :
Signatures by Language:
C/C++: bool triangle_rectangle_intersect(const triangle *tri, const rectangle *rect);
C/C++: bool triangle_rectangle_intersect_byval(const triangle tri, const rectangle rect);
C++: bool triangle_rectangle_intersect(const triangle &tri, const rectangle &rect);
Pascal: function TriangleRectangleIntersect(const tri: Triangle; const rect: Rectangle): Boolean;

### Triangle To String

Get a text description of the triangle.

• Triangle To String (const tri) : String [show]

Get a text description of the triangle.

Parameters:
tri : Triangle
Returns:
String :
Signatures by Language:
C/C++: void triangle_to_string(const triangle *tri, char *result);
C/C++: void triangle_to_string_byval(const triangle tri, char *result);
C++: void triangle_to_string(const triangle &tri, char *result);
Pascal: function TriangleToString(const tri: Triangle): String;

### Triangles Rectangle Intersect

Returns true if any of the triangles intersects with the rectangle.

• Triangles Rectangle Intersect (const tri, const rect) : Boolean [show]

Returns true if any of the triangles intersects with the rectangle.

Parameters:
tri : TriangleArray
rect : Rectangle
Returns:
Boolean :
Signatures by Language:
C/C++: bool triangles_rectangle_intersect(const triangle_array tri, const rectangle *rect, int32_t tri_len);
C/C++: bool triangles_rectangle_intersect_byval(const triangle_array tri, const rectangle rect, int32_t tri_len);
C++: bool triangles_rectangle_intersect(const triangle_array tri, const rectangle &rect, int32_t tri_len);
Pascal: function TrianglesRectangleIntersect(const tri: TriangleArray; const rect: Rectangle): Boolean;

### Unit Vector

Returns the unit vector of the parameter vector (v). The unit vector has a magnitude of 1, resulting in a vector that indicates the direction of the original vector.

• Unit Vector (const v) : Vector [show]

Returns the unit vector of the parameter vector (v). The unit vector has a magnitude of 1, resulting in a vector that indicates the direction of the original vector.

Parameters:
v : Vector
Returns:
Vector :
Signatures by Language:
C/C++: vector unit_vector(const vector *v);
C/C++: vector unit_vector_byval(const vector v);
C++: vector unit_vector(const vector &v);
Pascal: function UnitVector(const v: Vector): Vector;

### Vector Angle

Calculates the angle of a vector.

• Vector Angle (const v) : Single [show]

Calculates the angle of a vector.

Parameters:
v : Vector
Returns:
Single :
Signatures by Language:
C/C++: float vector_angle(const vector *v);
C/C++: float vector_angle_byval(const vector v);
C++: float vector_angle(const vector &v);
Pascal: function VectorAngle(const v: Vector): Single;

### Vector From Angle

Returns a new Vector created using the angle and magnitude (length). The angle and magnitude are scalar values and the angle is in degrees.

• Vector From Angle (angle, magnitude) : Vector [show]

Returns a new Vector created using the angle and magnitude (length). The angle and magnitude are scalar values and the angle is in degrees.

Parameters:
angle : Single
magnitude : Single
Returns:
Vector :
Signatures by Language:
C/C++: vector vector_from_angle(float angle, float magnitude);
Pascal: function VectorFromAngle(angle: Single; magnitude: Single): Vector;

### Vector From Point To Rect

Returns a vector from a point to the specified rectangle.

• Vector From Point To Rect (const pt, const rect) : Vector [show]

Returns a vector from a point to the specified rectangle.

Parameters:
pt : Point2D
rect : Rectangle
Returns:
Vector :
Signatures by Language:
C/C++: vector vector_from_point_pt_to_rectangle(const point2d *pt, const rectangle *rect);
C/C++: vector vector_from_point_pt_to_rectangle_byval(const point2d pt, const rectangle rect);
C++: vector vector_from_point_to_rect(const point2d &pt, const rectangle &rect);
Pascal: function VectorFromPointToRect(const pt: Point2D; const rect: Rectangle): Vector;
• Vector From Point To Rect (x, y, const rect) : Vector [show]

Returns a vector from the specified point to the specified rectangle.

Parameters:
x : Single
y : Single
rect : Rectangle
Returns:
Vector :
Signatures by Language:
C/C++: vector vector_from_point_to_rectangle(float x, float y, const rectangle *rect);
C/C++: vector vector_from_point_to_rectangle_byval(float x, float y, const rectangle rect);
C++: vector vector_from_point_to_rect(float x, float y, const rectangle &rect);
Pascal: function VectorFromPointToRect(x: Single; y: Single; const rect: Rectangle): Vector;
• Vector From Point To Rect (x, y, rectX, rectY, rectWidth, rectHeight) : Vector [show]

Returns a vector from the specified point to the specified rectangle.

Parameters:
x : Single
y : Single
rectX : Single
rectY : Single
rectWidth : Longint
rectHeight : Longint
Returns:
Vector :
Signatures by Language:
C/C++: vector vector_from_point_to_rect(float x, float y, float rectX, float rectY, int32_t rectWidth, int32_t rectHeight);
Pascal: function VectorFromPointToRect(x: Single; y: Single; rectX: Single; rectY: Single; rectWidth: Longint; rectHeight: Longint): Vector;

### Vector From Points

Returns a Vector created from the difference from the p1 to the second p2 points (Point2D).

• Vector From Points (const p1, const p2) : Vector [show]

Returns a Vector created from the difference from the p1 to the second p2 points (Point2D).

Parameters:
p1 : Point2D
p2 : Point2D
Returns:
Vector :
Signatures by Language:
C/C++: vector vector_from_points(const point2d *p1, const point2d *p2);
C/C++: vector vector_from_points_byval(const point2d p1, const point2d p2);
C++: vector vector_from_points(const point2d &p1, const point2d &p2);
Pascal: function VectorFromPoints(const p1: Point2D; const p2: Point2D): Vector;

### Vector In Rect

Returns true if the vector ends within the rectangle when started at the origin.

• Vector In Rect (const v, const rect) : Boolean [show]

Returns true if the vector ends within the rectangle when started at the origin.

Parameters:
v : Vector
rect : Rectangle
Returns:
Boolean :
Signatures by Language:
C/C++: bool vector_in_rect(const vector *v, const rectangle *rect);
C/C++: bool vector_in_rect_byval(const vector v, const rectangle rect);
C++: bool vector_in_rect(const vector &v, const rectangle &rect);
Pascal: function VectorInRect(const v: Vector; const rect: Rectangle): Boolean;
• Vector In Rect (const v, x, y, w, h) : Boolean [show]

Return true if the vector (used as a point) is within the rectangle

Parameters:
v : Vector
x : Single
y : Single
w : Single
h : Single
Returns:
Boolean :
Signatures by Language:
C/C++: bool vector_in_rect_xy(const vector *v, float x, float y, float w, float h);
C/C++: bool vector_in_rect_xy_byval(const vector v, float x, float y, float w, float h);
C++: bool vector_in_rect(const vector &v, float x, float y, float w, float h);
Pascal: function VectorInRect(const v: Vector; x: Single; y: Single; w: Single; h: Single): Boolean;

### Vector Is Zero

Test to see if the x and y components of the provided vector parameter v are zero.

• Vector Is Zero (const v) : Boolean [show]

Test to see if the x and y components of the provided vector parameter v are zero.

Parameters:
v : Vector
Returns:
Boolean :
Signatures by Language:
C/C++: bool vector_is_zero(const vector *v);
C/C++: bool vector_is_zero_byval(const vector v);
C++: bool vector_is_zero(const vector &v);
Pascal: function VectorIsZero(const v: Vector): Boolean;

### Vector Magnitude

Returns the magnitude (or "length") of the parameter vector (v) as a scalar value.

• Vector Magnitude (const v) : Single [show]

Returns the magnitude (or "length") of the parameter vector (v) as a scalar value.

Parameters:
v : Vector
Returns:
Single :
Signatures by Language:
C/C++: float vector_magnitude(const vector *v);
C/C++: float vector_magnitude_byval(const vector v);
C++: float vector_magnitude(const vector &v);
Pascal: function VectorMagnitude(const v: Vector): Single;

### Vector Magnitude Sq

Returns the squared magnitude (or "length") of the parameter vector (v) as a scalar value.

• Vector Magnitude Sq (const v) : Single [show]

Returns the squared magnitude (or "length") of the parameter vector (v) as a scalar value.

Parameters:
v : Vector
Returns:
Single :
Signatures by Language:
C/C++: float vector_magnitude_sq(const vector *v);
C/C++: float vector_magnitude_sq_byval(const vector v);
C++: float vector_magnitude_sq(const vector &v);
Pascal: function VectorMagnitudeSq(const v: Vector): Single;

### Vector Multiply

Multiplies each component (x and y values) of the v1 vector by the s scalar value and returns the result as a new Vector.

• Vector Multiply (const v, s) : Vector [show]

Multiplies each component (x and y values) of the v1 vector by the s scalar value and returns the result as a new Vector.

Parameters:
v : Vector
s : Single
Returns:
Vector :
Signatures by Language:
C/C++: vector vector_multiply(const vector *v, float s);
C/C++: vector vector_multiply_byval(const vector v, float s);
C++: vector vector_multiply(const vector &v, float s);
Pascal: function VectorMultiply(const v: Vector; s: Single): Vector;

### Vector Normal

Returns a new Vector that is perpendicular ("normal") to the parameter vector v provided. The concept of a "normal" vector is usually extracted from (or associated with) a line. See LineNormal.

• Vector Normal (const v) : Vector [show]

Returns a new Vector that is perpendicular ("normal") to the parameter vector v provided. The concept of a "normal" vector is usually extracted from (or associated with) a line. See LineNormal.

Parameters:
v : Vector
Returns:
Vector :
Signatures by Language:
C/C++: vector vector_normal(const vector *v);
C/C++: vector vector_normal_byval(const vector v);
C++: vector vector_normal(const vector &v);
Pascal: function VectorNormal(const v: Vector): Vector;

### Vector Out Of Circle From Circle

Returns a vector out of a circle for a given circle.

• Vector Out Of Circle From Circle (const src, const bounds, const velocity) : Vector [show]

Returns a vector out of a circle for a given circle.

Parameters:
src : Circle
bounds : Circle
velocity : Vector
Returns:
Vector :
Signatures by Language:
C/C++: vector vector_out_of_circle_from_circle(const circle *src, const circle *bounds, const vector *velocity);
C/C++: vector vector_out_of_circle_from_circle_byval(const circle src, const circle bounds, const vector velocity);
C++: vector vector_out_of_circle_from_circle(const circle &src, const circle &bounds, const vector &velocity);
Pascal: function VectorOutOfCircleFromCircle(const src: Circle; const bounds: Circle; const velocity: Vector): Vector;

### Vector Out Of Circle From Point

Returns the vector out of a circle from a given point.

• Vector Out Of Circle From Point (const pt, const c, const velocity) : Vector [show]

Returns the vector out of a circle from a given point.

Parameters:
pt : Point2D
c : Circle
velocity : Vector
Returns:
Vector :
Signatures by Language:
C/C++: vector vector_out_of_circle_from_point(const point2d *pt, const circle *c, const vector *velocity);
C/C++: vector vector_out_of_circle_from_point_byval(const point2d pt, const circle c, const vector velocity);
C++: vector vector_out_of_circle_from_point(const point2d &pt, const circle &c, const vector &velocity);
Pascal: function VectorOutOfCircleFromPoint(const pt: Point2D; const c: Circle; const velocity: Vector): Vector;

### Vector Out Of Rect From Circle

Returns a vector that can be used to move a circle out of a rectangle.

• Vector Out Of Rect From Circle (const c, const rect, const velocity) : Vector [show]

Returns a vector that can be used to move a circle out of a rectangle.

Parameters:
c : Circle
rect : Rectangle
velocity : Vector
Returns:
Vector :
Signatures by Language:
C/C++: vector vector_out_of_rect_from_circle(const circle *c, const rectangle *rect, const vector *velocity);
C/C++: vector vector_out_of_rect_from_circle_byval(const circle c, const rectangle rect, const vector velocity);
C++: vector vector_out_of_rect_from_circle(const circle &c, const rectangle &rect, const vector &velocity);
Pascal: function VectorOutOfRectFromCircle(const c: Circle; const rect: Rectangle; const velocity: Vector): Vector;

### Vector Out Of Rect From Point

Determines the vector needed to move from point pt out of rectangle rect given the velocity specified

• Vector Out Of Rect From Point (const pt, const rect, const velocity) : Vector [show]

Determines the vector needed to move from point pt out of rectangle rect given the velocity specified

Parameters:
pt : Point2D
rect : Rectangle
velocity : Vector
Returns:
Vector :
Signatures by Language:
C/C++: vector vector_out_of_rect_from_point(const point2d *pt, const rectangle *rect, const vector *velocity);
C/C++: vector vector_out_of_rect_from_point_byval(const point2d pt, const rectangle rect, const vector velocity);
C++: vector vector_out_of_rect_from_point(const point2d &pt, const rectangle &rect, const vector &velocity);
Pascal: function VectorOutOfRectFromPoint(const pt: Point2D; const rect: Rectangle; const velocity: Vector): Vector;

### Vector Out Of Rect From Rect

Returns the vector needed to move rectangle src out of rectanglebounds given the velocity specified.

• Vector Out Of Rect From Rect (const src, const bounds, const velocity) : Vector [show]

Returns the vector needed to move rectangle src out of rectanglebounds given the velocity specified.

Parameters:
src : Rectangle
bounds : Rectangle
velocity : Vector
Returns:
Vector :
Signatures by Language:
C/C++: vector vector_out_of_rect_from_rect(const rectangle *src, const rectangle *bounds, const vector *velocity);
C/C++: vector vector_out_of_rect_from_rect_byval(const rectangle src, const rectangle bounds, const vector velocity);
C++: vector vector_out_of_rect_from_rect(const rectangle &src, const rectangle &bounds, const vector &velocity);
Pascal: function VectorOutOfRectFromRect(const src: Rectangle; const bounds: Rectangle; const velocity: Vector): Vector;

### Vector Over Lines From Circle

Returns a vector that can be used to move a circle over the lines in the array.

• Vector Over Lines From Circle (const c, const lines, const velocity, out maxIdx) : Vector [show]

Returns a vector that can be used to move a circle over the lines in the array.

Parameters:
c : Circle
lines : LinesArray
velocity : Vector
maxIdx : Longint
Returns:
Vector :
Signatures by Language:
C/C++: vector vector_over_lines_from_circle(const circle *c, const lines_array lines, const vector *velocity, int32_t *maxIdx, int32_t lines_len);
C/C++: vector vector_over_lines_from_circle_byval(const circle c, const lines_array lines, const vector velocity, int32_t *maxIdx, int32_t lines_len);
C++: vector vector_over_lines_from_circle(const circle &c, const lines_array lines, const vector &velocity, int32_t &maxIdx, int32_t lines_len);
Pascal: function VectorOverLinesFromCircle(const c: Circle; const lines: LinesArray; const velocity: Vector; out maxIdx: Longint): Vector;

### Vector Over Lines From Lines

Returns a vector that can be used to move a group of lines back over other lines. This is used internally to determine vectors that can be used to move a rectangle back out of another rectangle and similar operations.

• Vector Over Lines From Lines (const srcLines, const boundLines, const velocity, out maxIdx) : Vector [show]

Returns a vector that can be used to move a group of lines back over other lines. This is used internally to determine vectors that can be used to move a rectangle back out of another rectangle and similar operations.

Parameters:
srcLines : LinesArray
boundLines : LinesArray
velocity : Vector
maxIdx : Longint
Returns:
Vector :
Signatures by Language:
C/C++: vector vector_over_lines_from_lines(const lines_array srcLines, const lines_array boundLines, const vector *velocity, int32_t *maxIdx, int32_t srcLines_len, int32_t boundLines_len);
C/C++: vector vector_over_lines_from_lines_byval(const lines_array srcLines, const lines_array boundLines, const vector velocity, int32_t *maxIdx, int32_t srcLines_len, int32_t boundLines_len);
C++: vector vector_over_lines_from_lines(const lines_array srcLines, const lines_array boundLines, const vector &velocity, int32_t &maxIdx, int32_t srcLines_len, int32_t boundLines_len);
Pascal: function VectorOverLinesFromLines(const srcLines: LinesArray; const boundLines: LinesArray; const velocity: Vector; out maxIdx: Longint): Vector;

### Vector To

Returns a new Vector using the x and y values provided.

• Vector To (x, y) : Vector [show]

Returns a new Vector using the x and y values provided.

Parameters:
x : Single
y : Single
Returns:
Vector :
Signatures by Language:
C/C++: vector vector_to(float x, float y);
Pascal: function VectorTo(x: Single; y: Single): Vector;
• Vector To (x, y, invertY) : Vector [show]

Creates a new Vector with the x and y values provided, and will invert the y value if the invertY parameter is True. The inversion of the y value provides a convienient option for handling screen related vectors.

Parameters:
x : Single
y : Single
invertY : Boolean
Returns:
Vector :
Signatures by Language:
C/C++: vector vector_to_with_invert_y(float x, float y, bool invertY);
C++: vector vector_to(float x, float y, bool invertY);
Pascal: function VectorTo(x: Single; y: Single; invertY: Boolean): Vector;

### Vector To Point

Returns a new Vector using the x and y value of a Point2D parameter.

• Vector To Point (const p1) : Vector [show]

Returns a new Vector using the x and y value of a Point2D parameter.

Parameters:
p1 : Point2D
Returns:
Vector :
Signatures by Language:
C/C++: vector vector_to_point(const point2d *p1);
C/C++: vector vector_to_point_byval(const point2d p1);
C++: vector vector_to_point(const point2d &p1);
Pascal: function VectorToPoint(const p1: Point2D): Vector;

### Vectors Equal

Determines if two vectors are equal.

• Vectors Equal (const v1, const v2) : Boolean [show]

Determines if two vectors are equal.

Parameters:
v1 : Vector
v2 : Vector
Returns:
Boolean :
Signatures by Language:
C/C++: bool vectors_equal(const vector *v1, const vector *v2);
C/C++: bool vectors_equal_byval(const vector v1, const vector v2);
C++: bool vectors_equal(const vector &v1, const vector &v2);
Pascal: function VectorsEqual(const v1: Vector; const v2: Vector): Boolean;

### Vectors Not Equal

Determines if two vectors are not equal.

• Vectors Not Equal (const v1, const v2) : Boolean [show]

Determines if two vectors are not equal.

Parameters:
v1 : Vector
v2 : Vector
Returns:
Boolean :
Signatures by Language:
C/C++: bool vectors_not_equal(const vector *v1, const vector *v2);
C/C++: bool vectors_not_equal_byval(const vector v1, const vector v2);
C++: bool vectors_not_equal(const vector &v1, const vector &v2);
Pascal: function VectorsNotEqual(const v1: Vector; const v2: Vector): Boolean;

### Widest Points

Returns the two widest points on the circle that lie along the indicated vector.

• Widest Points (const c, const along, out pt1, out pt2) [show]

Returns the two widest points on the circle that lie along the indicated vector.

Parameters:
c : Circle
along : Vector
pt1 : Point2D
pt2 : Point2D
Signatures by Language:
C/C++: void widest_points(const circle *c, const vector *along, point2d *pt1, point2d *pt2);
C/C++: void widest_points_byval(const circle c, const vector along, point2d *pt1, point2d *pt2);
C++: void widest_points(const circle &c, const vector &along, point2d &pt1, point2d &pt2);
Pascal: procedure WidestPoints(const c: Circle; const along: Vector; out pt1: Point2D; out pt2: Point2D);