Functions
Closest Point On Line
Gets the closest point on the line to a given point.
- Return Type
-
The point on the line that is closest to
From Pt
- Parameters
-
Name Type Description From Pt The point to test (usually somewhere near the line)
L The line
- Signatures
-
point_2d closest_point_on_line(const point_2d from_pt, const line &l)
public static Point2D Geometry.ClosestPointOnLine(Point2D fromPt, Line l); public static Point2D SplashKit.ClosestPointOnLine(Point2D fromPt, Line l);
function ClosestPointOnLine(fromPt: Point2D; const l: Line): Point2D
def closest_point_on_line(from_pt, l):
Closest Point On Lines
Get the point closest to From Pt
that is on one of the supplied lines.
- Return Type
-
The point on one of the lines that is the closest point on these lines to the
From Pt
. - Parameters
-
Name Type Description From Pt The point to test
Lines Dynamic Array
The lines to check
Line Idx Integer
After the call this will store the index of the line that had the matching point.
- Signatures
-
point_2d closest_point_on_lines(const point_2d from_pt, const vector<line> &lines, int &line_idx)
public static Point2D Geometry.ClosestPointOnLines(Point2D fromPt, List<Line> lines, ref int lineIdx); public static Point2D SplashKit.ClosestPointOnLines(Point2D fromPt, List<Line> lines, ref int lineIdx);
function ClosestPointOnLines(fromPt: Point2D; const lines: ArrayOfLine; var lineIdx: Integer): Point2D
def closest_point_on_lines(from_pt, lines, line_idx):
Line From
Line From
Create a line from one point to another.
- Return Type
-
A line from the start to the end point
- Parameters
-
Name Type Description Start The start of the line
End Pt The end of the line
- Signatures
-
line line_from(const point_2d &start, const point_2d &end_pt)
public static Line Geometry.LineFrom(Point2D start, Point2D endPt); public static Line SplashKit.LineFrom(Point2D start, Point2D endPt);
function LineFrom(const start: Point2D; const endPt: Point2D): Line
def line_from_point_to_point(start, end_pt):
Line From
Creates a line that starts at a point, and follows a given vector.
- Return Type
-
A line from the start to end point
- Parameters
-
Name Type Description Start The start of the line
Offset The offset to the end of the line
- Signatures
-
line line_from(const point_2d &start, const vector_2d &offset)
public static Line Geometry.LineFrom(Point2D start, Vector2D offset); public static Line SplashKit.LineFrom(Point2D start, Vector2D offset);
function LineFrom(const start: Point2D; const offset: Vector2D): Line
def line_from_start_with_offset(start, offset):
Line From
Gets a line that goes from the origin and ends at the end of the vector.
- Return Type
-
A line from the origin to the end point
- Parameters
-
Name Type Description V The offset from the origin for the end of the line
- Signatures
-
line line_from(const vector_2d &v)
public static Line Geometry.LineFrom(Vector2D v); public static Line SplashKit.LineFrom(Vector2D v);
function LineFrom(const v: Vector2D): Line
def line_from_vector(v):
Line From
Create a line from one point to another.
- Return Type
-
A line from the start to the end point
- Parameters
-
Name Type Description X1 Double
The x value of the start of the line
Y1 Double
The y value of the start of the line
X2 Double
The x value of the end of the line
Y2 Double
The y value of the end of the line
- Signatures
-
line line_from(double x1, double y1, double x2, double y2)
public static Line Geometry.LineFrom(double x1, double y1, double x2, double y2); public static Line SplashKit.LineFrom(double x1, double y1, double x2, double y2);
function LineFrom(x1: Double; y1: Double; x2: Double; y2: Double): Line
def line_from(x1, y1, x2, 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.
- Return Type
-
Boolean
[description]
- Parameters
-
Name Type Description Line1 The first line
Line2 The other line
Pt The resulting point where they intersect
- Signatures
-
bool line_intersection_point(const line &line1, const line &line2, point_2d &pt)
public static bool Geometry.LineIntersectionPoint(Line line1, Line line2, ref Point2D pt); public static bool SplashKit.LineIntersectionPoint(Line line1, Line line2, ref Point2D pt);
function LineIntersectionPoint(const line1: Line; const line2: Line; var pt: Point2D): Boolean
def line_intersection_point(line1, line2, pt):
Line Intersects Circle
Returns true if the line intersects the circle.
- Return Type
-
Boolean
True if the line
L
intersects the circleC
- Parameters
-
Name Type Description L The line
C The circle
- Signatures
-
bool line_intersects_circle(const line &l, const circle &c)
public static bool Geometry.LineIntersectsCircle(Line l, Circle c); public static bool SplashKit.LineIntersectsCircle(Line l, Circle c);
function LineIntersectsCircle(const l: Line; const c: Circle): Boolean
def line_intersects_circle(l, c):
Line Intersects Lines
Returns true if the line intersects any of the lines.
- Return Type
-
Boolean
True if
Line
intersects any of the lines inLines
- Parameters
-
Name Type Description L The line to check
Lines Dynamic Array
The lines to check against
- Signatures
-
bool line_intersects_lines(const line &l, const vector<line> &lines)
public static bool Geometry.LineIntersectsLines(Line l, List<Line> lines); public static bool SplashKit.LineIntersectsLines(Line l, List<Line> lines);
function LineIntersectsLines(const l: Line; const lines: ArrayOfLine): Boolean
def line_intersects_lines(l, lines):
Line Intersects Rect
Returns true if the line intersects the rectangle.
- Return Type
-
Boolean
True if
L
intersectsRect
- Parameters
-
Name Type Description L The line
Rect The rectangle
- Signatures
-
bool line_intersects_rect(const line &l, const rectangle &rect)
public static bool Geometry.LineIntersectsRect(Line l, Rectangle rect); public static bool SplashKit.LineIntersectsRect(Line l, Rectangle rect);
function LineIntersectsRect(const l: Line; const rect: Rectangle): Boolean
def line_intersects_rect(l, rect):
Line Length
Returns the length of a line.
- Return Type
-
Float
The length of the line
- Parameters
-
Name Type Description L The line
- Signatures
-
float line_length(const line &l)
public static float Geometry.LineLength(Line l); public static float SplashKit.LineLength(Line l);
function LineLength(const l: Line): Single
def line_length(l):
Line Length Squared
Returns the squared length of the line. You can also get the
Line Length
.
- Return Type
-
Float
The squared length of the line
- Parameters
-
Name Type Description L The line
- Signatures
-
float line_length_squared(const line &l)
public static float Geometry.LineLengthSquared(Line l); public static float SplashKit.LineLengthSquared(Line l);
function LineLengthSquared(const l: Line): Single
def line_length_squared(l):
Line Mid Point
Returns the center point of the line.
- Return Type
-
The point that is at the center of the line
- Parameters
-
Name Type Description L The line
- Signatures
-
point_2d line_mid_point(const line &l)
public static Point2D Geometry.LineMidPoint(Line l); public static Point2D SplashKit.LineMidPoint(Line l);
function LineMidPoint(const l: Line): Point2D
def line_mid_point(l):
Line Normal
The line normal (a perpendicular vector).
- Return Type
-
The line's normal vector
- Parameters
-
Name Type Description L The line
- Signatures
-
vector_2d line_normal(const line &l)
public static Vector2D Geometry.LineNormal(Line l); public static Vector2D SplashKit.LineNormal(Line l);
function LineNormal(const l: Line): Vector2D
def line_normal(l):
Line To String
Returns a text description of the line.
- Return Type
-
String
A text description of the line
- Parameters
-
Name Type Description Ln The line
- Signatures
-
string line_to_string(const line &ln)
public static string Geometry.LineToString(Line ln); public static string SplashKit.LineToString(Line ln);
function LineToString(const ln: Line): String
def line_to_string(ln):
Lines From
Lines From
Returns an array of lines from a supplied rectangle.
- Return Type
-
Dynamic Array
An array containing 4 lines
- Parameters
-
Name Type Description Rect The rectangle to get the lines from
- Signatures
-
vector<line> lines_from(const rectangle &rect)
public static List<Line> Geometry.LinesFrom(Rectangle rect); public static List<Line> SplashKit.LinesFrom(Rectangle rect);
function LinesFrom(const rect: Rectangle): ArrayOfLine
def lines_from_rectangle(rect):
Lines From
Returns an array of lines from the details in the triangle.
- Return Type
-
Dynamic Array
The lines from the triangle
- Parameters
-
Name Type Description T The triangle
- Signatures
-
vector<line> lines_from(const triangle &t)
public static List<Line> Geometry.LinesFrom(Triangle t); public static List<Line> SplashKit.LinesFrom(Triangle t);
function LinesFrom(const t: Triangle): ArrayOfLine
def lines_from_triangle(t):
Lines Intersect
Returns true if the two lines intersect.
- Return Type
-
Boolean
True if the two lines intersect (share a common point).
- Parameters
-
Name Type Description L1 The first line
L2 The other line
- Signatures
-
bool lines_intersect(const line &l1, const line &l2)
public static bool Geometry.LinesIntersect(Line l1, Line l2); public static bool SplashKit.LinesIntersect(Line l1, Line l2);
function LinesIntersect(const l1: Line; const l2: Line): Boolean
def lines_intersect(l1, l2):
Inset Rectangle
Return a rectangle that is inset an amount from a given rectangle.
- Return Type
-
A new rectangle created inset from
Rect
- Parameters
-
Name Type Description Rect The rectangle to inset
Inset Amount Float
The amount to inset the rectangle
- Signatures
-
rectangle inset_rectangle(const rectangle &rect, float inset_amount)
public static Rectangle Geometry.InsetRectangle(Rectangle rect, float insetAmount); public static Rectangle SplashKit.InsetRectangle(Rectangle rect, float insetAmount);
function InsetRectangle(const rect: Rectangle; insetAmount: Single): Rectangle
def inset_rectangle(rect, inset_amount):
Intersection
Returns a rectangle that represents the intersection of two rectangles.
- Return Type
-
The intersection of rect1 and rect2.
- Parameters
-
Name Type Description Rect1 The first rectangle
Rect2 The second rectangle
- Signatures
-
rectangle intersection(const rectangle &rect1, const rectangle &rect2)
public static Rectangle Geometry.Intersection(Rectangle rect1, Rectangle rect2); public static Rectangle SplashKit.Intersection(Rectangle rect1, Rectangle rect2);
function Intersection(const rect1: Rectangle; const rect2: Rectangle): Rectangle
def intersection(rect1, rect2):
Rectangle Around
Rectangle Around
Returns a rectangle that surrounds a given triangle
- Return Type
-
A rectangle that will surround the triangle
- Parameters
-
Name Type Description T The triangle
- Signatures
-
rectangle rectangle_around(const triangle &t)
public static Rectangle Geometry.RectangleAround(Triangle t); public static Rectangle SplashKit.RectangleAround(Triangle t);
function RectangleAround(const t: Triangle): Rectangle
def rectangle_around_triangle(t):
Rectangle Around
Returns a rectangle that surrounds a given circle
- Return Type
-
A rectangle that will surround the circle
- Parameters
-
Name Type Description C The circle
- Signatures
-
rectangle rectangle_around(const circle &c)
public static Rectangle Geometry.RectangleAround(Circle c); public static Rectangle SplashKit.RectangleAround(Circle c);
function RectangleAround(const c: Circle): Rectangle
def rectangle_around_circle(c):
Rectangle Around
Returns a rectangle that surrounds a given line segment
- Return Type
-
A rectangle that will surround the line
- Parameters
-
Name Type Description L The line
- Signatures
-
rectangle rectangle_around(const line &l)
public static Rectangle Geometry.RectangleAround(Line l); public static Rectangle SplashKit.RectangleAround(Line l);
function RectangleAround(const l: Line): Rectangle
def rectangle_around_line(l):
Rectangle Bottom
The location of the bottom of the rectangle.
- Return Type
-
Float
The distance from the top of the screen to the bottom of the rectangle.
- Parameters
-
Name Type Description Rect The rectangle.
- Signatures
-
float rectangle_bottom(const rectangle &rect)
public static float Geometry.RectangleBottom(Rectangle rect); public static float SplashKit.RectangleBottom(Rectangle rect);
function RectangleBottom(const rect: Rectangle): Single
def rectangle_bottom(rect):
Rectangle Center
Returns the center point of a given rectangle
- Return Type
-
The center point of the vector
- Parameters
-
Name Type Description Rect The rectangle
- Signatures
-
point_2d rectangle_center(const rectangle &rect)
public static Point2D Geometry.RectangleCenter(Rectangle rect); public static Point2D SplashKit.RectangleCenter(Rectangle rect);
function RectangleCenter(const rect: Rectangle): Point2D
def rectangle_center(rect):
Rectangle From
Rectangle From
Returns a rectangle at the specified point with a given width and height
- Return Type
-
A rectangle with the specified dimensions and location
- Parameters
-
Name Type Description Pt The origin for the rectangle
Width Double
Its width
Height Double
Its height
- Signatures
-
rectangle rectangle_from(const point_2d pt, const double width, const double height)
public static Rectangle Geometry.RectangleFrom(Point2D pt, double width, double height); public static Rectangle SplashKit.RectangleFrom(Point2D pt, double width, double height);
function RectangleFrom(pt: Point2D; width: Double; height: Double): Rectangle
def rectangle_from_point_and_size(pt, width, height):
Rectangle From
Returns a rectangle with pt1 and pt2 defining the two distant edge points.
- Return Type
-
A rectangle enclosing the two points.
- Parameters
-
Name Type Description Pt1 The first point
Pt2 The second point
- Signatures
-
rectangle rectangle_from(const point_2d pt1, const point_2d pt2)
public static Rectangle Geometry.RectangleFrom(Point2D pt1, Point2D pt2); public static Rectangle SplashKit.RectangleFrom(Point2D pt1, Point2D pt2);
function RectangleFrom(pt1: Point2D; pt2: Point2D): Rectangle
def rectangle_from_points(pt1, pt2):
Rectangle From
Returns a rectangle from a given x,y location with the specified width and height.
- Return Type
-
A rectangle with the specified dimensions and location.
- Parameters
-
Name Type Description X Double
The x coordinate of the rectangle
Y Double
The y coordinate of the rectangle
Width Double
The width of the rectangle
Height Double
The height of the rectangle
- Signatures
-
rectangle rectangle_from(double x, double y, double width, double height)
public static Rectangle Geometry.RectangleFrom(double x, double y, double width, double height); public static Rectangle SplashKit.RectangleFrom(double x, double y, double width, double height);
function RectangleFrom(x: Double; y: Double; width: Double; height: Double): Rectangle
def rectangle_from(x, y, width, height):
Rectangle Left
The location of the left edge of the rectangle.
- Return Type
-
Float
The distance from the left of the screen to the left side of the rectangle.
- Parameters
-
Name Type Description Rect The rectangle.
- Signatures
-
float rectangle_left(const rectangle &rect)
public static float Geometry.RectangleLeft(Rectangle rect); public static float SplashKit.RectangleLeft(Rectangle rect);
function RectangleLeft(const rect: Rectangle): Single
def rectangle_left(rect):
Rectangle Offset By
Returns a rectangle that is moved by the provided vector.
- Return Type
-
A new rectangle that represents the original rectangle after being moved by the offset vector.
- Parameters
-
Name Type Description Rect The original rectangle
Offset The amount and direction for the rectangle to move
- Signatures
-
rectangle rectangle_offset_by(const rectangle &rect, const vector_2d &offset)
public static Rectangle Geometry.RectangleOffsetBy(Rectangle rect, Vector2D offset); public static Rectangle SplashKit.RectangleOffsetBy(Rectangle rect, Vector2D offset);
function RectangleOffsetBy(const rect: Rectangle; const offset: Vector2D): Rectangle
def rectangle_offset_by(rect, offset):
Rectangle Right
The location of the right edge of the rectangle.
- Return Type
-
Float
The distance from the left of the screen to the right side of the rectangle.
- Parameters
-
Name Type Description Rect The rectangle.
- Signatures
-
float rectangle_right(const rectangle &rect)
public static float Geometry.RectangleRight(Rectangle rect); public static float SplashKit.RectangleRight(Rectangle rect);
function RectangleRight(const rect: Rectangle): Single
def rectangle_right(rect):
Rectangle To String
Get a text representation of the passed in rectangle.
- Return Type
-
String
A string representation of the rectangle.
- Parameters
-
Name Type Description Rect The rectangle
- Signatures
-
string rectangle_to_string(const rectangle &rect)
public static string Geometry.RectangleToString(Rectangle rect); public static string SplashKit.RectangleToString(Rectangle rect);
function RectangleToString(const rect: Rectangle): String
def rectangle_to_string(rect):
Rectangle Top
The top of the rectangle.
- Return Type
-
Float
Its distance from the top of the screen.
- Parameters
-
Name Type Description Rect The rectangle.
- Signatures
-
float rectangle_top(const rectangle &rect)
public static float Geometry.RectangleTop(Rectangle rect); public static float SplashKit.RectangleTop(Rectangle rect);
function RectangleTop(const rect: Rectangle): Single
def rectangle_top(rect):
Rectangles Intersect
Returns true if the two rectangles intersect.
- Return Type
-
Boolean
True when rect1 and rect2 intersect.
- Parameters
-
Name Type Description Rect1 The first rectangle
Rect2 The second rectangle
- Signatures
-
bool rectangles_intersect(const rectangle &rect1, const rectangle &rect2)
public static bool Geometry.RectanglesIntersect(Rectangle rect1, Rectangle rect2); public static bool SplashKit.RectanglesIntersect(Rectangle rect1, Rectangle rect2);
function RectanglesIntersect(const rect1: Rectangle; const rect2: Rectangle): Boolean
def rectangles_intersect(rect1, rect2):
Triangle Barycenter
Return the barycenter of the triangle. This is one way of calculating the center point of a triangle.
- Return Type
-
The point that is the barycenter of
Tri
- Parameters
-
Name Type Description Tri The triangle to get the center of
- Signatures
-
point_2d triangle_barycenter(const triangle &tri)
public static Point2D Geometry.TriangleBarycenter(Triangle tri); public static Point2D SplashKit.TriangleBarycenter(Triangle tri);
function TriangleBarycenter(const tri: Triangle): Point2D
def triangle_barycenter(tri):
Triangle From
Triangle From
Generate a triangle from a set of points.
- Return Type
-
A triangle with the indicated points
- Parameters
-
Name Type Description P1 The first point of the triangle
P2 The second point of the triangle
P3 The third point of the triangle
- Signatures
-
triangle triangle_from(const point_2d &p1, const point_2d &p2, const point_2d &p3)
public static Triangle Geometry.TriangleFrom(Point2D p1, Point2D p2, Point2D p3); public static Triangle SplashKit.TriangleFrom(Point2D p1, Point2D p2, Point2D p3);
function TriangleFrom(const p1: Point2D; const p2: Point2D; const p3: Point2D): Triangle
def triangle_from(p1, p2, p3):
Triangle From
Generate a triangle from a set of points.
- Return Type
-
A triangle at the indicated points
- Parameters
-
Name Type Description X1 Double
The x coordinate for the first point
Y1 Double
The y coordinate for the first point
X2 Double
The x coordinate for the second point
Y2 Double
The y coordinate for the second point
X3 Double
The x coordinate for the third point
Y3 Double
The y coordinate for the third point
- Signatures
-
triangle triangle_from(double x1, double y1, double x2, double y2, double x3, double y3)
public static Triangle Geometry.TriangleFrom(double x1, double y1, double x2, double y2, double x3, double y3); public static Triangle SplashKit.TriangleFrom(double x1, double y1, double x2, double y2, double x3, double y3);
function TriangleFrom(x1: Double; y1: Double; x2: Double; y2: Double; x3: Double; y3: Double): Triangle
def triangle_from__from_coordinates(x1, y1, x2, y2, x3, y3):
Triangle Rectangle Intersect
Returns true if the triangle intersects with the rectangle.
- Return Type
-
Boolean
True if the triangle and rect intersect
- Parameters
-
Name Type Description Tri The triangle to test
Rect The rectangle to test
- Signatures
-
bool triangle_rectangle_intersect(const triangle &tri, const rectangle &rect)
public static bool Geometry.TriangleRectangleIntersect(Triangle tri, Rectangle rect); public static bool SplashKit.TriangleRectangleIntersect(Triangle tri, Rectangle rect);
function TriangleRectangleIntersect(const tri: Triangle; const rect: Rectangle): Boolean
def triangle_rectangle_intersect(tri, rect):
Triangle To String
Returns a text description of the triangle.
- Return Type
-
String
A text description of the triangle.
- Parameters
-
Name Type Description Tri The triangle
- Signatures
-
string triangle_to_string(const triangle &tri)
public static string Geometry.TriangleToString(Triangle tri); public static string SplashKit.TriangleToString(Triangle tri);
function TriangleToString(const tri: Triangle): String
def triangle_to_string(tri):
Triangles Intersect
Returns true if the two triangles intersect.
- Return Type
-
Boolean
True if the two triangles intersect
- Parameters
-
Name Type Description T1 The first triangle
T2 The other triangle
- Signatures
-
bool triangles_intersect(const triangle &t1, const triangle &t2)
public static bool Geometry.TrianglesIntersect(Triangle t1, Triangle t2); public static bool SplashKit.TrianglesIntersect(Triangle t1, Triangle t2);
function TrianglesIntersect(const t1: Triangle; const t2: Triangle): Boolean
def triangles_intersect(t1, t2):
Point At
Returns a point at the given location.
- Return Type
-
A point at the given location
- Parameters
-
Name Type Description X Double
The x value of the coordinate
Y Double
The y value of the coordinate
- Signatures
-
point_2d point_at(double x, double y)
public static Point2D Geometry.PointAt(double x, double y); public static Point2D SplashKit.PointAt(double x, double y);
function PointAt(x: Double; y: Double): Point2D
def point_at(x, y):
Point At Origin
Returns a point representing the origin.
- Return Type
-
A point with x and y set to 0
- Signatures
-
point_2d point_at_origin()
public static Point2D Geometry.PointAtOrigin(); public static Point2D SplashKit.PointAtOrigin();
function PointAtOrigin(): Point2D
def point_at_origin():
Point In Circle
Returns true if the point Pt
is in the circle C
.
- Return Type
-
Boolean
True if the point is within the area of the circle
- Parameters
-
Name Type Description Pt The point to test
C The circle to check
- Signatures
-
bool point_in_circle(const point_2d &pt, const circle &c)
public static bool Geometry.PointInCircle(Point2D pt, Circle c); public static bool SplashKit.PointInCircle(Point2D pt, Circle c);
function PointInCircle(const pt: Point2D; const c: Circle): Boolean
def point_in_circle(pt, c):
Point In Quad
Tests if a point is in a quad.
- Return Type
-
Boolean
True if pt lies within the area of q.
- Parameters
-
Name Type Description Pt The point to test.
Q The quad to check if the point is within.
- Signatures
-
bool point_in_quad(const point_2d &pt, const quad &q)
public static bool Geometry.PointInQuad(Point2D pt, Quad q); public static bool SplashKit.PointInQuad(Point2D pt, Quad q);
function PointInQuad(const pt: Point2D; const q: Quad): Boolean
def point_in_quad(pt, q):
Point In Rectangle
Returns true if point Pt
is in the Rectangle Rect
.
- Return Type
-
Boolean
True if the point is within the rectangle
- Parameters
-
Name Type Description Pt The point to test
Rect The rectangle to check
- Signatures
-
bool point_in_rectangle(const point_2d &pt, const rectangle &rect)
public static bool Geometry.PointInRectangle(Point2D pt, Rectangle rect); public static bool SplashKit.PointInRectangle(Point2D pt, Rectangle rect);
function PointInRectangle(const pt: Point2D; const rect: Rectangle): Boolean
def point_in_rectangle(pt, rect):
Point In Triangle
Returns true if the point Pt
is in the Triangle Tri
.
- Return Type
-
Boolean
True if the point is within the triangle
- Parameters
-
Name Type Description Pt The point to test
Tri The triangle to check
- Signatures
-
bool point_in_triangle(const point_2d &pt, const triangle &tri)
public static bool Geometry.PointInTriangle(Point2D pt, Triangle tri); public static bool SplashKit.PointInTriangle(Point2D pt, Triangle tri);
function PointInTriangle(const pt: Point2D; const tri: Triangle): Boolean
def point_in_triangle(pt, tri):
Point Line Distance
Returns the distance from a point to a line.
- Return Type
-
Float
The distance from
Pt
toL
- Parameters
-
Name Type Description Pt The point
L The line
- Signatures
-
float point_line_distance(const point_2d &pt, const line &l)
public static float Geometry.PointLineDistance(Point2D pt, Line l); public static float SplashKit.PointLineDistance(Point2D pt, Line l);
function PointLineDistance(const pt: Point2D; const l: Line): Single
def point_line_distance(pt, l):
Point Offset By
Calculate the Point 2D
that is offset from the Start Point
by the
Offset
- Return Type
-
A new point as a result of moving by the offset from the starting point
- Parameters
-
Name Type Description Start Point The starting point
Offset The distance and direction to move
- Signatures
-
point_2d point_offset_by(const point_2d &start_point, const vector_2d &offset)
public static Point2D Geometry.PointOffsetBy(Point2D startPoint, Vector2D offset); public static Point2D SplashKit.PointOffsetBy(Point2D startPoint, Vector2D offset);
function PointOffsetBy(const startPoint: Point2D; const offset: Vector2D): Point2D
def point_offset_by(start_point, offset):
Point Offset From Origin
Returns the point offset from the origin by the provided vector.
- Return Type
-
A new point as a result of moving by the offset from the starting point
- Parameters
-
Name Type Description Offset The distance and direction to move
- Signatures
-
point_2d point_offset_from_origin(const vector_2d &offset)
public static Point2D Geometry.PointOffsetFromOrigin(Vector2D offset); public static Point2D SplashKit.PointOffsetFromOrigin(Vector2D offset);
function PointOffsetFromOrigin(const offset: Vector2D): Point2D
def point_offset_from_origin(offset):
Point On Line
Point On Line
Returns true if point Pt
is on the line L
.
- Return Type
-
Boolean
True if the point is on the line
- Parameters
-
Name Type Description Pt The point to test
L The line to check
- Signatures
-
bool point_on_line(const point_2d &pt, const line &l)
public static bool Geometry.PointOnLine(Point2D pt, Line l); public static bool SplashKit.PointOnLine(Point2D pt, Line l);
function PointOnLine(const pt: Point2D; const l: Line): Boolean
def point_on_line(pt, 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.
- Return Type
-
Boolean
True if the point is on the line
- Parameters
-
Name Type Description Pt The point to test
L The line to check
Proximity Float
The sensitivity to allow close approximities
- Signatures
-
bool point_on_line(const point_2d &pt, const line &l, float proximity)
public static bool Geometry.PointOnLine(Point2D pt, Line l, float proximity); public static bool SplashKit.PointOnLine(Point2D pt, Line l, float proximity);
function PointOnLine(const pt: Point2D; const l: Line; proximity: Single): Boolean
def point_on_line_with_proximity(pt, l, proximity):
Point Point Angle
Returns the angle between two points in degrees.
- Return Type
-
Float
The angle (in degrees) of the line between the points
- Parameters
-
Name Type Description Pt1 The first point
Pt2 The other point
- Signatures
-
float point_point_angle(const point_2d &pt1, const point_2d &pt2)
public static float Geometry.PointPointAngle(Point2D pt1, Point2D pt2); public static float SplashKit.PointPointAngle(Point2D pt1, Point2D pt2);
function PointPointAngle(const pt1: Point2D; const pt2: Point2D): Single
def point_point_angle(pt1, pt2):
Point Point Distance
Returns the distance between two points.
- Return Type
-
Float
The distance between the two points
- Parameters
-
Name Type Description Pt1 The first point
Pt2 The other point
- Signatures
-
float point_point_distance(const point_2d &pt1, const point_2d &pt2)
public static float Geometry.PointPointDistance(Point2D pt1, Point2D pt2); public static float SplashKit.PointPointDistance(Point2D pt1, Point2D pt2);
function PointPointDistance(const pt1: Point2D; const pt2: Point2D): Single
def point_point_distance(pt1, pt2):
Point To String
Get a text description of the Point 2D
.
- Return Type
-
String
A string representation of the point
- Parameters
-
Name Type Description Pt The point details
- Signatures
-
string point_to_string(const point_2d &pt)
public static string Geometry.PointToString(Point2D pt); public static string SplashKit.PointToString(Point2D pt);
function PointToString(const pt: Point2D): String
def point_to_string(pt):
Random Bitmap Point
Returns a random point within the bounds of the bitmap.
- Return Type
-
A point within the bounds of the bitmap
- Parameters
-
Name Type Description Bmp The bitmap
- Signatures
-
point_2d random_bitmap_point(bitmap bmp)
public static Point2D Geometry.RandomBitmapPoint(Bitmap bmp); public static Point2D SplashKit.RandomBitmapPoint(Bitmap bmp);
function RandomBitmapPoint(bmp: Bitmap): Point2D
def random_bitmap_point(bmp):
Random Screen Point
Returns a random point on the current window.
- Return Type
-
A point within the bounds of the current window
- Signatures
-
point_2d random_screen_point()
public static Point2D Geometry.RandomScreenPoint(); public static Point2D SplashKit.RandomScreenPoint();
function RandomScreenPoint(): Point2D
def random_screen_point():
Random Window Point
Returns a random point on the provided window.
- Return Type
-
A point within the bounds of the window
- Parameters
-
Name Type Description Wind The window
- Signatures
-
point_2d random_window_point(window wind)
public static Point2D Geometry.RandomWindowPoint(Window wind); public static Point2D SplashKit.RandomWindowPoint(Window wind);
function RandomWindowPoint(wind: Window): Point2D
def random_window_point(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.
- Return Type
-
Boolean
True if the two points are at the same location
- Parameters
-
Name Type Description Pt1 The first point
Pt2 The other point
- Signatures
-
bool same_point(const point_2d &pt1, const point_2d &pt2)
public static bool Geometry.SamePoint(Point2D pt1, Point2D pt2); public static bool SplashKit.SamePoint(Point2D pt1, Point2D pt2);
function SamePoint(const pt1: Point2D; const pt2: Point2D): Boolean
def same_point(pt1, pt2):
Center Point
Returns the center point of the circle.
- Return Type
-
The center point of the circle
- Parameters
-
Name Type Description C The circle to get the center point
- Signatures
-
point_2d center_point(const circle &c)
public static Point2D Geometry.CenterPoint(Circle c); public static Point2D SplashKit.CenterPoint(Circle c);
function CenterPoint(const c: Circle): Point2D
def center_point(c):
Circle At
Circle At
Returns a circle at the indicated point and radius.
- Return Type
-
A circle at the indicatd point and radius
- Parameters
-
Name Type Description Pt The location of the center of the circle
Radius Double
The radius of the circle
- Signatures
-
circle circle_at(const point_2d &pt, double radius)
public static Circle Geometry.CircleAt(Point2D pt, double radius); public static Circle SplashKit.CircleAt(Point2D pt, double radius);
function CircleAt(const pt: Point2D; radius: Double): Circle
def circle_at(pt, radius):
Circle At
Returns a circle at the indicated point and radius.
- Return Type
-
A circle at the indicatd point and radius
- Parameters
-
Name Type Description X Double
The x location of the circle
Y Double
The y location of the circle
Radius Double
The radius of the circle
- Signatures
-
circle circle_at(double x, double y, double radius)
public static Circle Geometry.CircleAt(double x, double y, double radius); public static Circle SplashKit.CircleAt(double x, double y, double radius);
function CircleAt(x: Double; y: Double; radius: Double): Circle
def circle_at_from_points(x, y, radius):
Circle Radius
Returns the circle radius.
- Return Type
-
Float
The radius of the circle
- Parameters
-
Name Type Description C The circle
- Signatures
-
float circle_radius(const circle c)
public static float Geometry.CircleRadius(Circle c); public static float SplashKit.CircleRadius(Circle c);
function CircleRadius(c: Circle): Single
def circle_radius(c):
Circle X
Returns the circle x value.
- Return Type
-
Float
The x location of the center of the circle
- Parameters
-
Name Type Description C The circle
- Signatures
-
float circle_x(const circle &c)
public static float Geometry.CircleX(Circle c); public static float SplashKit.CircleX(Circle c);
function CircleX(const c: Circle): Single
def circle_x(c):
Circle Y
Returns the circle y value.
- Return Type
-
Float
The y location of the center of the circle
- Parameters
-
Name Type Description C The circle
- Signatures
-
float circle_y(const circle &c)
public static float Geometry.CircleY(Circle c); public static float SplashKit.CircleY(Circle c);
function CircleY(const c: Circle): Single
def circle_y(c):
Circles Intersect
Detects if two circles intersect. This can be used to detect collisions between bounding circles.
- Return Type
-
Boolean
True if the two circles do intersect
- Parameters
-
Name Type Description C1 The circle to test if intersects with c2
C2 The circle to test if intersects with c1
- Signatures
-
bool circles_intersect(circle c1, circle c2)
public static bool Geometry.CirclesIntersect(Circle c1, Circle c2); public static bool SplashKit.CirclesIntersect(Circle c1, Circle c2);
function CirclesIntersect(c1: Circle; c2: Circle): Boolean
def circles_intersect(c1, c2):
Closest Point On Circle
The closest point on the circle to the given point.
- Return Type
-
The point on c that is closest to the from point
- Parameters
-
Name Type Description From Pt The point to test from
C The circle you want to get a point on its circumference
- Signatures
-
point_2d closest_point_on_circle(const point_2d &from_pt, const circle &c)
public static Point2D Geometry.ClosestPointOnCircle(Point2D fromPt, Circle c); public static Point2D SplashKit.ClosestPointOnCircle(Point2D fromPt, Circle c);
function ClosestPointOnCircle(const fromPt: Point2D; const c: Circle): Point2D
def closest_point_on_circle(from_pt, c):
Closest Point On Line From Circle
Returns the closest point on a line to a circle.
- Return Type
-
The point that is closest to
C
onL
- Parameters
-
Name Type Description C The circle
L The line
- Signatures
-
point_2d closest_point_on_line_from_circle(const circle &c, const line &l)
public static Point2D Geometry.ClosestPointOnLineFromCircle(Circle c, Line l); public static Point2D SplashKit.ClosestPointOnLineFromCircle(Circle c, Line l);
function ClosestPointOnLineFromCircle(const c: Circle; const l: Line): Point2D
def closest_point_on_line_from_circle(c, l):
Closest Point On Rect From Circle
Returns the closest point on a rectangle to a circle.
- Return Type
-
The point that is closest to
C
onRect
- Parameters
-
Name Type Description C The circle
Rect The rectangle
- Signatures
-
point_2d closest_point_on_rect_from_circle(const circle &c, const rectangle &rect)
public static Point2D Geometry.ClosestPointOnRectFromCircle(Circle c, Rectangle rect); public static Point2D SplashKit.ClosestPointOnRectFromCircle(Circle c, Rectangle rect);
function ClosestPointOnRectFromCircle(const c: Circle; const rect: Rectangle): Point2D
def closest_point_on_rect_from_circle(c, rect):
Distant Point On Circle
The furthest point on the circle to the given point.
- Return Type
-
The point on c that is furthest from
Pt
- Parameters
-
Name Type Description Pt The point to test from
C The circle you want to get a point on its circumference
- Signatures
-
point_2d distant_point_on_circle(const point_2d &pt, const circle &c)
public static Point2D Geometry.DistantPointOnCircle(Point2D pt, Circle c); public static Point2D SplashKit.DistantPointOnCircle(Point2D pt, Circle c);
function DistantPointOnCircle(const pt: Point2D; const c: Circle): Point2D
def distant_point_on_circle(pt, c):
Distant Point On Circle Heading
Determines the opposite side of a circle given a collision point and a heading.
- Return Type
-
Boolean
True when the
Opposite Pt
is calculated, false when the point would not collide with the circle when heading as indicated. - Parameters
-
Name Type Description Pt The point from which the test is being made
C The circle
Heading The direction the point is heading
Opposite Pt After 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.
- Signatures
-
bool distant_point_on_circle_heading(const point_2d &pt, const circle &c, const vector_2d &heading, point_2d &opposite_pt)
public static bool Geometry.DistantPointOnCircleHeading(Point2D pt, Circle c, Vector2D heading, ref Point2D oppositePt); public static bool SplashKit.DistantPointOnCircleHeading(Point2D pt, Circle c, Vector2D heading, ref Point2D oppositePt);
function DistantPointOnCircleHeading(const pt: Point2D; const c: Circle; const heading: Vector2D; var oppositePt: Point2D): Boolean
def distant_point_on_circle_heading(pt, c, heading, opposite_pt):
Ray Circle Intersect Distance
Calculates the distance from a ray cast from a point to a given circle.
- Return Type
-
Float
-1 if the ray does not hit the circle, otherwise the distance from the origin to the circle bounds.
- Parameters
-
Name Type Description Ray Origin The origin of the ray
Ray Heading The direction of the ray
C The circle being tested
- Signatures
-
float ray_circle_intersect_distance(const point_2d &ray_origin, const vector_2d &ray_heading, const circle &c)
public static float Geometry.RayCircleIntersectDistance(Point2D rayOrigin, Vector2D rayHeading, Circle c); public static float SplashKit.RayCircleIntersectDistance(Point2D rayOrigin, Vector2D rayHeading, Circle c);
function RayCircleIntersectDistance(const rayOrigin: Point2D; const rayHeading: Vector2D; const c: Circle): Single
def ray_circle_intersect_distance(ray_origin, ray_heading, c):
Tangent Points
Returns the two tangent points on the circle given the indicated point.
- Return Type
-
Boolean
True if
From Pt
is outside of the circle, and tangent points are calculated - Parameters
-
Name Type Description From Pt The source point
C The circle
P1 If this returns true, then
P1
contains one of the pointsP2 If this returns true, then
P2
contains one of the points - Signatures
-
bool tangent_points(const point_2d &from_pt, const circle &c, point_2d &p1, point_2d &p2)
public static bool Geometry.TangentPoints(Point2D fromPt, Circle c, ref Point2D p1, ref Point2D p2); public static bool SplashKit.TangentPoints(Point2D fromPt, Circle c, ref Point2D p1, ref Point2D p2);
function TangentPoints(const fromPt: Point2D; const c: Circle; var p1: Point2D; var p2: Point2D): Boolean
def tangent_points(from_pt, c, p1, 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
-
Name Type Description C The circle
Along The vector representing the line along which the points lie.
Pt1 After the call, this is set to one of the widest points
Pt2 After 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)
public static void Geometry.WidestPoints(Circle c, Vector2D along, ref Point2D pt1, ref Point2D pt2); public static void SplashKit.WidestPoints(Circle c, Vector2D along, ref Point2D pt1, ref Point2D pt2);
procedure WidestPoints(const c: Circle; const along: Vector2D; var pt1: Point2D; var pt2: Point2D)
def widest_points(c, along, pt1, pt2):
Quad From
-
Quad From
(
p1
:
Point 2D
p2 :Point 2D
p3 :Point 2D
p4 :Point 2D
) -
Quad From
(
rect
:
Rectangle
) -
Quad From
(
rect
:
Rectangle
transform :Matrix 2D
) -
Quad From
(
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 :Double
)
Quad From
Returns a quad from the passed in points.
- Return Type
-
A quad from the passed in points
- Parameters
-
Name Type Description P1 The top left of the quad.
P2 The top right of the quad
P3 The bottom left of the quad
P4 The bottom right of the quad
- Signatures
-
quad quad_from(const point_2d &p1, const point_2d &p2, const point_2d &p3, const point_2d &p4)
public static Quad Geometry.QuadFrom(Point2D p1, Point2D p2, Point2D p3, Point2D p4); public static Quad SplashKit.QuadFrom(Point2D p1, Point2D p2, Point2D p3, Point2D p4);
function QuadFrom(const p1: Point2D; const p2: Point2D; const p3: Point2D; const p4: Point2D): Quad
def quad_from_points(p1, p2, p3, p4):
Quad From
Returns a quad from the x-y points of a given recatangle
- Return Type
-
A quad at the same location as the rectangle
- Parameters
-
Name Type Description Rect The rectangle to convert to a quad
- Signatures
-
quad quad_from(const rectangle &rect)
public static Quad Geometry.QuadFrom(Rectangle rect); public static Quad SplashKit.QuadFrom(Rectangle rect);
function QuadFrom(const rect: Rectangle): Quad
def quad_from_rectangle(rect):
Quad From
Returns a quad from the rectangle, then applies the transformation to the quads points.
- Return Type
-
A quad that represents the rectangle after the transformation.
- Parameters
-
Name Type Description Rect The rectangle to transform to a quad.
Transform A transform to apply to the resulting quad.
- Signatures
-
quad quad_from(const rectangle &rect, const matrix_2d &transform)
public static Quad Geometry.QuadFrom(Rectangle rect, Matrix2D transform); public static Quad SplashKit.QuadFrom(Rectangle rect, Matrix2D transform);
function QuadFrom(const rect: Rectangle; const transform: Matrix2D): Quad
def quad_from_rectangle_with_transformation(rect, transform):
Quad From
Returns a quad for the passed in x & y points.
- Return Type
-
A quad with the indicated points
- Parameters
-
Name Type Description X Top Left Double
X coordinate of the top left of the quad
Y Top Left Double
Y coordinate of the top left of the quad
X Top Right Double
X coordinate of the top right of the quad
Y Top Right Double
Y coordinate of the top right of the quad
X Bottom Left Double
X coordinate of the bottom left of the quad
Y Bottom Left Double
Y coordinate of the bottom left of the quad
X Bottom Right Double
X coordinate of the bottom right of the quad
Y Bottom Right Double
Y coordinate of the bottom right of the 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)
public static Quad Geometry.QuadFrom(double xTopLeft, double yTopLeft, double xTopRight, double yTopRight, double xBottomLeft, double yBottomLeft, double xBottomRight, double yBottomRight); public static Quad SplashKit.QuadFrom(double xTopLeft, double yTopLeft, double xTopRight, double yTopRight, double xBottomLeft, double yBottomLeft, double xBottomRight, double yBottomRight);
function QuadFrom(xTopLeft: Double; yTopLeft: Double; xTopRight: Double; yTopRight: Double; xBottomLeft: Double; yBottomLeft: Double; xBottomRight: Double; yBottomRight: Double): Quad
def quad_from(x_top_left, y_top_left, x_top_right, y_top_right, x_bottom_left, y_bottom_left, x_bottom_right, y_bottom_right):
Quads Intersect
Returns true if two quads intersect.
- Return Type
-
Boolean
True if the two quads intersect.
- Parameters
-
Name Type Description Q1 The first quad
Q2 The second quad
- Signatures
-
bool quads_intersect(const quad &q1, const quad &q2)
public static bool Geometry.QuadsIntersect(Quad q1, Quad q2); public static bool SplashKit.QuadsIntersect(Quad q1, Quad q2);
function QuadsIntersect(const q1: Quad; const q2: Quad): Boolean
def quads_intersect(q1, q2):
Set Quad Point
Change a point in a quad.
- Parameters
-
Name Type Description Q The quad to change
Idx Integer
The index of the point: 0 is top left, 1 is top right, 2 is bottom left, and 3 is bottom right
Value The new value for that point in the quad
- Signatures
-
void set_quad_point(quad &q, int idx, const point_2d &value)
public static void Geometry.SetQuadPoint(ref Quad q, int idx, Point2D value); public static void SplashKit.SetQuadPoint(ref Quad q, int idx, Point2D value);
procedure SetQuadPoint(var q: Quad; idx: Integer; const value: Point2D)
def set_quad_point(q, idx, value):
Triangles From
Returns the two triangles that make up a quad in a vector.
- Return Type
-
Dynamic Array
A vector with the two triangles from the quad.
- Parameters
-
Name Type Description Q The quad
- Signatures
-
vector<triangle> triangles_from(const quad &q)
public static List<Triangle> Geometry.TrianglesFrom(Quad q); public static List<Triangle> SplashKit.TrianglesFrom(Quad q);
function TrianglesFrom(const q: Quad): ArrayOfTriangle
def triangles_from(q):
Cosine
Returns the cosine of the supplied angle (in degrees).
- Return Type
-
Float
the cosine of the supplied angle (in degrees).
- Parameters
-
Name Type Description Degrees Float
The angle in degrees
- Signatures
-
float cosine(float degrees)
public static float Geometry.Cosine(float degrees); public static float SplashKit.Cosine(float degrees);
function Cosine(degrees: Single): Single
def cosine(degrees):
Sine
Returns the sine of the supplied angle (in degrees).
- Return Type
-
Float
the sine of the supplied angle (in degrees).
- Parameters
-
Name Type Description Degrees Float
The angle in degrees
- Signatures
-
float sine(float degrees)
public static float Geometry.Sine(float degrees); public static float SplashKit.Sine(float degrees);
function Sine(degrees: Single): Single
def sine(degrees):
Tangent
Returns the tangent of the supplied angle (in degrees).
- Return Type
-
Float
the tangent of the supplied angle (in degrees).
- Parameters
-
Name Type Description Degrees Float
The angle in degrees
- Signatures
-
float tangent(float degrees)
public static float Geometry.Tangent(float degrees); public static float SplashKit.Tangent(float degrees);
function Tangent(degrees: Single): Single
def tangent(degrees):