Skip to content

Geometry

Functions

Center Point

Returns the center point of the circle.

Parameters:

NameTypeDescription
cCircleThe circle to get the center point

Return Type: Point 2d

Signatures:

point_2d center_point(const circle &c)

Circle At

Circle At

Returns a circle at the indicated point and radius.

Parameters:

NameTypeDescription
ptPoint 2dThe location of the center of the circle
radiusDoubleThe radius of the circle

Return Type: Circle

Signatures:

circle circle_at(const point_2d &pt, double radius)

Circle At

Returns a circle at the indicated point and radius.

Parameters:

NameTypeDescription
xDoubleThe x location of the circle
yDoubleThe y location of the circle
radiusDoubleThe radius of the circle

Return Type: Circle

Signatures:

circle circle_at(double x, double y, double radius)

Circle Radius

Returns the circle radius.

Parameters:

NameTypeDescription
cCircleThe circle

Return Type: Float

Signatures:

float circle_radius(const circle c)

Circle Triangle Intersect

Circle Triangle Intersect

Detects if a circle intersects with a triangle.

Parameters:

NameTypeDescription
cCircleThe circle to test
triTriangleThe triangle to test

Return Type: Boolean

Signatures:

bool circle_triangle_intersect(const circle &c, const triangle &tri)

Circle Triangle Intersect

Detects if a circle intersects with a triangle. The closest point on the triangle to the circle is assigned to p, even if the circle and triangle do not intersect. If the centre of the circle is inside the triangle, the point assigned to p is the centre of the circle.

Parameters:

NameTypeDescription
cCircleThe circle to test
triTriangleThe triangle to test
pPoint 2dThe point to set to the closest point on the triangle to the circle

Return Type: Boolean

Signatures:

bool circle_triangle_intersect(const circle &c, const triangle &tri, point_2d &p)

Circle X

Returns the circle x value.

Parameters:

NameTypeDescription
cCircleThe circle

Return Type: Float

Signatures:

float circle_x(const circle &c)

Circle Y

Returns the circle y value.

Parameters:

NameTypeDescription
cCircleThe circle

Return Type: Float

Signatures:

float circle_y(const circle &c)

Circles Intersect

Circles Intersect

Detects if two circles intersect. This can be used to detect collisions between bounding circles.

Parameters:

NameTypeDescription
c1CircleThe circle to test if intersects with c2
c2CircleThe circle to test if intersects with c1

Return Type: Boolean

Signatures:

bool circles_intersect(circle c1, circle c2)

Circles Intersect

Detects if two circles intersect. This can be used to detect collisions between bounding circles. The circle data is passed in as individual values.

Parameters:

NameTypeDescription
c1_xDoublethe x location of the first circle
c1_yDoublethe y location of the first circle
c1_radiusDoublethe radius of the first circle
c2_xDoublethe x location of the second circle
c2_yDoublethe y location of the second circle
c2_radiusDoublethe radius of the second circle

Return Type: Boolean

Signatures:

bool circles_intersect(double c1_x, double c1_y, double c1_radius, double c2_x, double c2_y, double c2_radius)

Closest Point On Circle

The closest point on the circle to the given point.

Parameters:

NameTypeDescription
from_ptPoint 2dThe point to test from
cCircleThe circle you want to get a point on its circumference

Return Type: Point 2d

Signatures:

point_2d closest_point_on_circle(const point_2d &from_pt, const circle &c)

Closest Point On Line From Circle

Returns the closest point on a line to a circle.

Parameters:

NameTypeDescription
cCircleThe circle
lLineThe line

Return Type: Point 2d

Signatures:

point_2d closest_point_on_line_from_circle(const circle &c, const line &l)

Closest Point On Rect From Circle

Returns the closest point on a rectangle to a circle.

Parameters:

NameTypeDescription
cCircleThe circle
rectRectangleThe rectangle

Return Type: Point 2d

Signatures:

point_2d closest_point_on_rect_from_circle(const circle &c, const rectangle &rect)

Closest Point On Triangle From Circle

Calculates the closest point on a triangle to a circle. If the circle and triangle do not intersect, the closest point on the triangle to the circle is returned. If the circle and triangle do intersect, the center of the circle is returned.

Parameters:

NameTypeDescription
cCircleThe circle to test
triTriangleThe triangle to test

Return Type: Point 2d

Signatures:

point_2d closest_point_on_triangle_from_circle(const circle &c, const triangle &tri)

Distant Point On Circle

The furthest point on the circle to the given point.

Parameters:

NameTypeDescription
ptPoint 2dThe point to test from
cCircleThe circle you want to get a point on its circumference

Return Type: Point 2d

Signatures:

point_2d distant_point_on_circle(const point_2d &pt, const circle &c)

Distant Point On Circle Heading

Determines the opposite side of a circle given a collision point and a heading.

Parameters:

NameTypeDescription
ptPoint 2dThe point from which the test is being made
cCircleThe circle
headingVector 2dThe direction the point is heading
opposite_ptPoint 2dAfter the call, this is set to the point on the opposite side of the circle from pt when it is heading in the given direction.

Return Type: Boolean

Signatures:

bool distant_point_on_circle_heading(const point_2d &pt, const circle &c, const vector_2d &heading, point_2d &opposite_pt)

Ray Circle Intersect Distance

Calculates the distance from a ray cast from a point to a given circle.

Parameters:

NameTypeDescription
ray_originPoint 2dThe origin of the ray
ray_headingVector 2dThe direction of the ray
cCircleThe circle being tested

Return Type: Float

Signatures:

float ray_circle_intersect_distance(const point_2d &ray_origin, const vector_2d &ray_heading, const circle &c)

Tangent Points

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

Parameters:

NameTypeDescription
from_ptPoint 2dThe source point
cCircleThe circle
p1Point 2dIf this returns true, then p1 contains one of the points
p2Point 2dIf this returns true, then p2 contains one of the points

Return Type: Boolean

Signatures:

bool tangent_points(const point_2d &from_pt, const circle &c, point_2d &p1, point_2d &p2)

Widest Points

Calculates the two points on a circles radius that lie along the given vector. This represents the points on the circle when the vector is placed at the circle’s center point.

Parameters:

NameTypeDescription
cCircleThe circle
alongVector 2dThe vector representing the line along which the points lie.
pt1Point 2dAfter the call, this is set to one of the widest points
pt2Point 2dAfter the call, this is set to one of the widest points

Signatures:

void widest_points(const circle &c, const vector_2d &along, point_2d &pt1, point_2d &pt2)

Cosine

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

Parameters:

NameTypeDescription
degreesFloatThe angle in degrees

Return Type: Float

Signatures:

float cosine(float degrees)

Sine

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

Parameters:

NameTypeDescription
degreesFloatThe angle in degrees

Return Type: Float

Signatures:

float sine(float degrees)

Tangent

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

Parameters:

NameTypeDescription
degreesFloatThe angle in degrees

Return Type: Float

Signatures:

float tangent(float degrees)

Closest Point On Line

Gets the closest point on the line to a given point.

Parameters:

NameTypeDescription
from_ptPoint 2dThe point to test (usually somewhere near the line)
lLineThe line

Return Type: Point 2d

Signatures:

point_2d closest_point_on_line(const point_2d from_pt, const line &l)

Closest Point On Lines

Get the point closest to from pt that is on one of the supplied lines.

Parameters:

NameTypeDescription
from_ptPoint 2dThe point to test
linesVectorThe lines to check
line_idxIntegerAfter the call this will store the index of the line that had the matching point.

Return Type: Point 2d

Signatures:

point_2d closest_point_on_lines(const point_2d from_pt, const vector<line> &lines, int &line_idx)

Line From

Line From

Create a line from one point to another.

Parameters:

NameTypeDescription
startPoint 2dThe start of the line
end_ptPoint 2dThe end of the line

Return Type: Line

Signatures:

line line_from(const point_2d &start, const point_2d &end_pt)

Line From

Creates a line that starts at a point, and follows a given vector.

Parameters:

NameTypeDescription
startPoint 2dThe start of the line
offsetVector 2dThe offset to the end of the line

Return Type: Line

Signatures:

line line_from(const point_2d &start, const vector_2d &offset)

Line From

Gets a line that goes from the origin and ends at the end of the vector.

Parameters:

NameTypeDescription
vVector 2dThe offset from the origin for the end of the line

Return Type: Line

Signatures:

line line_from(const vector_2d &v)

Line From

Create a line from one point to another.

Parameters:

NameTypeDescription
x1DoubleThe x value of the start of the line
y1DoubleThe y value of the start of the line
x2DoubleThe x value of the end of the line
y2DoubleThe y value of the end of the line

Return Type: Line

Signatures:

line line_from(double x1, double y1, double x2, double y2)

Line Intersection Point

Returns the point at which two lines would intersect. This point may lie past the end of one or both lines.

Parameters:

NameTypeDescription
line1LineThe first line
line2LineThe other line
ptPoint 2dThe resulting point where they intersect

Return Type: Boolean

Signatures:

bool line_intersection_point(const line &line1, const line &line2, point_2d &pt)

Line Intersects Circle

Returns true if the line intersects the circle.

Parameters:

NameTypeDescription
lLineThe line
cCircleThe circle

Return Type: Boolean

Signatures:

bool line_intersects_circle(const line &l, const circle &c)

Line Intersects Lines

Returns true if the line intersects any of the lines.

Parameters:

NameTypeDescription
lLineThe line to check
linesVectorThe lines to check against

Return Type: Boolean

Signatures:

bool line_intersects_lines(const line &l, const vector<line> &lines)

Line Intersects Rect

Returns true if the line intersects the rectangle.

Parameters:

NameTypeDescription
lLineThe line
rectRectangleThe rectangle

Return Type: Boolean

Signatures:

bool line_intersects_rect(const line &l, const rectangle &rect)

Line Length

Returns the length of a line.

Parameters:

NameTypeDescription
lLineThe line

Return Type: Float

Signatures:

float line_length(const line &l)

Line Length Squared

Returns the squared length of the line. You can also get the Line Length.

Parameters:

NameTypeDescription
lLineThe line

Return Type: Float

Signatures:

float line_length_squared(const line &l)

Line Mid Point

Returns the center point of the line.

Parameters:

NameTypeDescription
lLineThe line

Return Type: Point 2d

Signatures:

point_2d line_mid_point(const line &l)

Line Normal

The line normal (a perpendicular vector).

Parameters:

NameTypeDescription
lLineThe line

Return Type: Vector 2d

Signatures:

vector_2d line_normal(const line &l)

Line To String

Returns a text description of the line.

Parameters:

NameTypeDescription
lnLineThe line

Return Type: String

Signatures:

string line_to_string(const line &ln)

Lines From

Lines From

Returns an array of lines from a supplied rectangle.

Parameters:

NameTypeDescription
rectRectangleThe rectangle to get the lines from

Return Type: Vector

Signatures:

vector<line> lines_from(const rectangle &rect)

Lines From

Returns an array of lines from the details in the triangle.

Parameters:

NameTypeDescription
tTriangleThe triangle

Return Type: Vector

Signatures:

vector<line> lines_from(const triangle &t)

Lines Intersect

Returns true if the two lines intersect.

Parameters:

NameTypeDescription
l1LineThe first line
l2LineThe other line

Return Type: Boolean

Signatures:

bool lines_intersect(const line &l1, const line &l2)

Point At

Returns a point at the given location.

Parameters:

NameTypeDescription
xDoubleThe x value of the coordinate
yDoubleThe y value of the coordinate

Return Type: Point 2d

Signatures:

point_2d point_at(double x, double y)

Point At Origin

Returns a point representing the origin.

Return Type: Point 2d

Signatures:

point_2d point_at_origin()

Point In Circle

Point In Circle

Returns true if the point pt is in the circle c.

Parameters:

NameTypeDescription
ptPoint 2dThe point to test
cCircleThe circle to check

Return Type: Boolean

Signatures:

bool point_in_circle(const point_2d &pt, const circle &c)

Point In Circle

Return true if the point is in the circle.

Parameters:

NameTypeDescription
ptxDoublethe x value of the point
ptyDoublethe y value of the point
cxDoublethe x value of the centre of the circle
cyDoublethe y value of the centre of the circle
radiusDoublethe radius of the circle

Return Type: Boolean

Signatures:

bool point_in_circle(double ptx, double pty, double cx, double cy, double radius)

Point In Quad

Tests if a point is in a quad.

Parameters:

NameTypeDescription
ptPoint 2dThe point to test.
qQuadThe quad to check if the point is within.

Return Type: Boolean

Signatures:

bool point_in_quad(const point_2d &pt, const quad &q)

Point In Rectangle

Point In Rectangle

Returns true if point pt is in the Rectangle rect.

Parameters:

NameTypeDescription
ptPoint 2dThe point to test
rectRectangleThe rectangle to check

Return Type: Boolean

Signatures:

bool point_in_rectangle(const point_2d &pt, const rectangle &rect)

Point In Rectangle

Returns true if the point is within the bounds of a Rectangle.

Parameters:

NameTypeDescription
ptxDoublethe x value of the point
ptyDoublethe y value of the point
rect_xDoublex value of the rectangle
rect_yDoubley value of the rectangle
rect_widthDoublewidth of the rectangle
rect_heightDoubleheight of the rectangle

Return Type: Boolean

Signatures:

bool point_in_rectangle(double ptx, double pty, double rect_x, double rect_y, double rect_width, double rect_height)

Point In Triangle

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

Parameters:

NameTypeDescription
ptPoint 2dThe point to test
triTriangleThe triangle to check

Return Type: Boolean

Signatures:

bool point_in_triangle(const point_2d &pt, const triangle &tri)

Point Line Distance

Returns the distance from a point to a line.

Parameters:

NameTypeDescription
ptPoint 2dThe point
lLineThe line

Return Type: Float

Signatures:

float point_line_distance(const point_2d &pt, const line &l)

Point Offset By

Calculate the Point 2d that is offset from the start_point by the offset

Parameters:

NameTypeDescription
start_pointPoint 2dThe starting point
offsetVector 2dThe distance and direction to move

Return Type: Point 2d

Signatures:

point_2d point_offset_by(const point_2d &start_point, const vector_2d &offset)

Point Offset From Origin

Returns the point offset from the origin by the provided vector.

Parameters:

NameTypeDescription
offsetVector 2dThe distance and direction to move

Return Type: Point 2d

Signatures:

point_2d point_offset_from_origin(const vector_2d &offset)

Point On Line

Point On Line

Returns true if point pt is on the line l.

Parameters:

NameTypeDescription
ptPoint 2dThe point to test
lLineThe line to check

Return Type: Boolean

Signatures:

bool point_on_line(const point_2d &pt, const line &l)

Point On Line

Returns true when the point pt is on the line l. The proximity value is used to set the sensitivity — higher values effectively make the line thicker.

Parameters:

NameTypeDescription
ptPoint 2dThe point to test
lLineThe line to check
proximityFloatThe sensitivity to allow close approximities

Return Type: Boolean

Signatures:

bool point_on_line(const point_2d &pt, const line &l, float proximity)

Point Point Angle

Returns the angle between two points in degrees.

Parameters:

NameTypeDescription
pt1Point 2dThe first point
pt2Point 2dThe other point

Return Type: Float

Signatures:

float point_point_angle(const point_2d &pt1, const point_2d &pt2)

Point Point Distance

Returns the distance between two points.

Parameters:

NameTypeDescription
pt1Point 2dThe first point
pt2Point 2dThe other point

Return Type: Float

Signatures:

float point_point_distance(const point_2d &pt1, const point_2d &pt2)

Point To String

Get a text description of the Point 2d.

Parameters:

NameTypeDescription
ptPoint 2dThe point details

Return Type: String

Signatures:

string point_to_string(const point_2d &pt)

Random Bitmap Point

Returns a random point within the bounds of the bitmap.

Parameters:

NameTypeDescription
bmpBitmapThe bitmap

Return Type: Point 2d

Signatures:

point_2d random_bitmap_point(bitmap bmp)

Random Screen Point

Returns a random point on the current window.

Return Type: Point 2d

Signatures:

point_2d random_screen_point()

Random Window Point

Returns a random point on the provided window.

Parameters:

NameTypeDescription
windWindowThe window

Return Type: Point 2d

Signatures:

point_2d random_window_point(window wind)

Same Point

Returns True of pt1 is at the same point as pt2. This checks at an integer level, indicating the two points refer to the same pixel.

Parameters:

NameTypeDescription
pt1Point 2dThe first point
pt2Point 2dThe other point

Return Type: Boolean

Signatures:

bool same_point(const point_2d &pt1, const point_2d &pt2)

Quad From

Quad From

Returns a quad from the passed in points.

Parameters:

NameTypeDescription
p1Point 2dThe top left of the quad.
p2Point 2dThe top right of the quad
p3Point 2dThe bottom left of the quad
p4Point 2dThe bottom right of the quad

Return Type: Quad

Signatures:

quad quad_from(const point_2d &p1, const point_2d &p2, const point_2d &p3, const point_2d &p4)

Quad From

Returns a quad from the x-y points of a given recatangle

Parameters:

NameTypeDescription
rectRectangleThe rectangle to convert to a quad

Return Type: Quad

Signatures:

quad quad_from(const rectangle &rect)

Quad From

Returns a quad from the rectangle, then applies the transformation to the quads points.

Parameters:

NameTypeDescription
rectRectangleThe rectangle to transform to a quad.
transformMatrix 2dA transform to apply to the resulting quad.

Return Type: Quad

Signatures:

quad quad_from(const rectangle &rect, const matrix_2d &transform)

Quad From

Returns a quad for the passed in x & y points.

Parameters:

NameTypeDescription
x_top_leftDoubleX coordinate of the top left of the quad
y_top_leftDoubleY coordinate of the top left of the quad
x_top_rightDoubleX coordinate of the top right of the quad
y_top_rightDoubleY coordinate of the top right of the quad
x_bottom_leftDoubleX coordinate of the bottom left of the quad
y_bottom_leftDoubleY coordinate of the bottom left of the quad
x_bottom_rightDoubleX coordinate of the bottom right of the quad
y_bottom_rightDoubleY coordinate of the bottom right of the quad

Return Type: Quad

Signatures:

quad quad_from(double x_top_left, double y_top_left, double x_top_right, double y_top_right, double x_bottom_left, double y_bottom_left, double x_bottom_right, double y_bottom_right)

Quads Intersect

Returns true if two quads intersect.

Parameters:

NameTypeDescription
q1QuadThe first quad
q2QuadThe second quad

Return Type: Boolean

Signatures:

bool quads_intersect(const quad &q1, const quad &q2)

Set Quad Point

Change a point in a quad.

Parameters:

NameTypeDescription
qQuadThe quad to change
idxIntegerThe index of the point: 0 is top left, 1 is top right, 2 is bottom left, and 3 is bottom right
valuePoint 2dThe new value for that point in the quad

Signatures:

void set_quad_point(quad &q, int idx, const point_2d &value)

Triangles From

Returns the two triangles that make up a quad in a vector.

Parameters:

NameTypeDescription
qQuadThe quad

Return Type: Vector

Signatures:

vector<triangle> triangles_from(const quad &q)

Inset Rectangle

Return a rectangle that is inset an amount from a given rectangle.

Parameters:

NameTypeDescription
rectRectangleThe rectangle to inset
inset_amountFloatThe amount to inset the rectangle

Return Type: Rectangle

Signatures:

rectangle inset_rectangle(const rectangle &rect, float inset_amount)

Intersection

Returns a rectangle that represents the intersection of two rectangles.

Parameters:

NameTypeDescription
rect1RectangleThe first rectangle
rect2RectangleThe second rectangle

Return Type: Rectangle

Signatures:

rectangle intersection(const rectangle &rect1, const rectangle &rect2)

Rectangle Around

Rectangle Around

Returns a rectangle that surrounds a given circle

Parameters:

NameTypeDescription
cCircleThe circle

Return Type: Rectangle

Signatures:

rectangle rectangle_around(const circle &c)

Rectangle Around

Returns a rectangle that surrounds a given line segment

Parameters:

NameTypeDescription
lLineThe line

Return Type: Rectangle

Signatures:

rectangle rectangle_around(const line &l)

Rectangle Around

Returns a rectangle that surrounds a given quad.

Parameters:

NameTypeDescription
qQuadThe quad

Return Type: Rectangle

Signatures:

rectangle rectangle_around(const quad &q)

Rectangle Around

Returns a rectangle that surrounds a given triangle

Parameters:

NameTypeDescription
tTriangleThe triangle

Return Type: Rectangle

Signatures:

rectangle rectangle_around(const triangle &t)

Rectangle Bottom

The location of the bottom of the rectangle.

Parameters:

NameTypeDescription
rectRectangleThe rectangle.

Return Type: Float

Signatures:

float rectangle_bottom(const rectangle &rect)

Rectangle Center

Returns the center point of a given rectangle

Parameters:

NameTypeDescription
rectRectangleThe rectangle

Return Type: Point 2d

Signatures:

point_2d rectangle_center(const rectangle &rect)

Rectangle From

Rectangle From

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

Parameters:

NameTypeDescription
ptPoint 2dThe origin for the rectangle
widthDoubleIts width
heightDoubleIts height

Return Type: Rectangle

Signatures:

rectangle rectangle_from(const point_2d pt, const double width, const double height)

Rectangle From

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

Parameters:

NameTypeDescription
pt1Point 2dThe first point
pt2Point 2dThe second point

Return Type: Rectangle

Signatures:

rectangle rectangle_from(const point_2d pt1, const point_2d pt2)

Rectangle From

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

Parameters:

NameTypeDescription
xDoubleThe x coordinate of the rectangle
yDoubleThe y coordinate of the rectangle
widthDoubleThe width of the rectangle
heightDoubleThe height of the rectangle

Return Type: Rectangle

Usage:

Signatures:

rectangle rectangle_from(double x, double y, double width, double height)

Rectangle Left

The location of the left edge of the rectangle.

Parameters:

NameTypeDescription
rectRectangleThe rectangle.

Return Type: Float

Signatures:

float rectangle_left(const rectangle &rect)

Rectangle Offset By

Returns a rectangle that is moved by the provided vector.

Parameters:

NameTypeDescription
rectRectangleThe original rectangle
offsetVector 2dThe amount and direction for the rectangle to move

Return Type: Rectangle

Signatures:

rectangle rectangle_offset_by(const rectangle &rect, const vector_2d &offset)

Rectangle Right

The location of the right edge of the rectangle.

Parameters:

NameTypeDescription
rectRectangleThe rectangle.

Return Type: Float

Signatures:

float rectangle_right(const rectangle &rect)

Rectangle To String

Get a text representation of the passed in rectangle.

Parameters:

NameTypeDescription
rectRectangleThe rectangle

Return Type: String

Signatures:

string rectangle_to_string(const rectangle &rect)

Rectangle Top

The top of the rectangle.

Parameters:

NameTypeDescription
rectRectangleThe rectangle.

Return Type: Float

Signatures:

float rectangle_top(const rectangle &rect)

Rectangles Intersect

Returns true if the two rectangles intersect.

Parameters:

NameTypeDescription
rect1RectangleThe first rectangle
rect2RectangleThe second rectangle

Return Type: Boolean

Signatures:

bool rectangles_intersect(const rectangle &rect1, const rectangle &rect2)

Triangle Barycenter

Return the barycenter of the triangle. This is one way of calculating the center point of a triangle.

Parameters:

NameTypeDescription
triTriangleThe triangle to get the center of

Return Type: Point 2d

Signatures:

point_2d triangle_barycenter(const triangle &tri)

Triangle From

Triangle From

Generate a triangle from a set of points.

Parameters:

NameTypeDescription
p1Point 2dThe first point of the triangle
p2Point 2dThe second point of the triangle
p3Point 2dThe third point of the triangle

Return Type: Triangle

Signatures:

triangle triangle_from(const point_2d &p1, const point_2d &p2, const point_2d &p3)

Triangle From

Generate a triangle from a set of points.

Parameters:

NameTypeDescription
x1DoubleThe x coordinate for the first point
y1DoubleThe y coordinate for the first point
x2DoubleThe x coordinate for the second point
y2DoubleThe y coordinate for the second point
x3DoubleThe x coordinate for the third point
y3DoubleThe y coordinate for the third point

Return Type: Triangle

Signatures:

triangle triangle_from(double x1, double y1, double x2, double y2, double x3, double y3)

Triangle Rectangle Intersect

Returns true if the triangle intersects with the rectangle.

Parameters:

NameTypeDescription
triTriangleThe triangle to test
rectRectangleThe rectangle to test

Return Type: Boolean

Signatures:

bool triangle_rectangle_intersect(const triangle &tri, const rectangle &rect)

Triangle To String

Returns a text description of the triangle.

Parameters:

NameTypeDescription
triTriangleThe triangle

Return Type: String

Signatures:

string triangle_to_string(const triangle &tri)

Triangles Intersect

Returns true if the two triangles intersect.

Parameters:

NameTypeDescription
t1TriangleThe first triangle
t2TriangleThe other triangle

Return Type: Boolean

Signatures:

bool triangles_intersect(const triangle &t1, const triangle &t2)