Physics
Functions
Bitmap Circle Collision
Bitmap Circle Collision
Tests if a bitmap drawn at pt
would intersect with a circle.
Parameters:
Name | Type | Description |
---|---|---|
bmp | Bitmap | The bitmap to test |
pt | Point 2d | The location where the bitmap is drawn |
circ | Circle | The circle to test |
Return Type: Boolean
Signatures:
bool bitmap_circle_collision(bitmap bmp, const point_2d &pt, const circle &circ)
public bool Bitmap.CircleCollision(Point2D pt, Circle circ);public static bool SplashKit.BitmapCircleCollision(Bitmap bmp, Point2D pt, Circle circ);
def bitmap_circle_collision_at_point(bmp, pt, circ):
function BitmapCircleCollision(bmp: Bitmap; const pt: Point2D; const circ: Circle): Boolean
Bitmap Circle Collision
Tests if a bitmap drawn at x
, y
would intersect with a circle.
Parameters:
Name | Type | Description |
---|---|---|
bmp | Bitmap | The bitmap to test |
x | Double | The x location where the bitmap is drawn |
y | Double | The y location where the bitmap is drawn |
circ | Circle | The circle to test |
Return Type: Boolean
Signatures:
bool bitmap_circle_collision(bitmap bmp, double x, double y, const circle &circ)
public bool Bitmap.CircleCollision(double x, double y, Circle circ);public static bool SplashKit.BitmapCircleCollision(Bitmap bmp, double x, double y, Circle circ);
def bitmap_circle_collision(bmp, x, y, circ):
function BitmapCircleCollision(bmp: Bitmap; x: Double; y: Double; const circ: Circle): Boolean
Bitmap Circle Collision
Tests if a bitmap cell drawn using a passed in translation, will intersect with a circle. You can use this to detect collisions between bitmaps and circles.
Parameters:
Name | Type | Description |
---|---|---|
bmp | Bitmap | The bitmap to test |
cell | Integer | The cell of the bitmap to check |
translation | Matrix 2d | The matrix used to transfrom the bitmap when drawing |
circ | Circle | The circle to test |
Return Type: Boolean
Signatures:
bool bitmap_circle_collision(bitmap bmp, int cell, const matrix_2d &translation, const circle &circ)
public bool Bitmap.CircleCollision(int cell, Matrix2D translation, Circle circ);public static bool SplashKit.BitmapCircleCollision(Bitmap bmp, int cell, Matrix2D translation, Circle circ);
def bitmap_circle_collision_for_cell_with_translation(bmp, cell, translation, circ):
function BitmapCircleCollision(bmp: Bitmap; cell: Integer; const translation: Matrix2D; const circ: Circle): Boolean
Bitmap Circle Collision
Tests if a bitmap cell drawn at pt
would intersect with a circle.
Parameters:
Name | Type | Description |
---|---|---|
bmp | Bitmap | The bitmap to test |
cell | Integer | The cell of the bitmap to check |
pt | Point 2d | The location where the bitmap is drawn |
circ | Circle | The circle to test |
Return Type: Boolean
Signatures:
bool bitmap_circle_collision(bitmap bmp, int cell, const point_2d &pt, const circle &circ)
public bool Bitmap.CircleCollision(int cell, Point2D pt, Circle circ);public static bool SplashKit.BitmapCircleCollision(Bitmap bmp, int cell, Point2D pt, Circle circ);
def bitmap_circle_collision_for_cell_at_point(bmp, cell, pt, circ):
function BitmapCircleCollision(bmp: Bitmap; cell: Integer; const pt: Point2D; const circ: Circle): Boolean
Bitmap Circle Collision
Tests if a bitmap cell drawn at x
, y
would intersect with a circle.
Parameters:
Name | Type | Description |
---|---|---|
bmp | Bitmap | The bitmap to test |
cell | Integer | The cell of the bitmap to check |
x | Double | The x location where the bitmap is drawn |
y | Double | The y location where the bitmap is drawn |
circ | Circle | The circle to test |
Return Type: Boolean
Signatures:
bool bitmap_circle_collision(bitmap bmp, int cell, double x, double y, const circle &circ)
public bool Bitmap.CircleCollision(int cell, double x, double y, Circle circ);public static bool SplashKit.BitmapCircleCollision(Bitmap bmp, int cell, double x, double y, Circle circ);
def bitmap_circle_collision_for_cell(bmp, cell, x, y, circ):
function BitmapCircleCollision(bmp: Bitmap; cell: Integer; x: Double; y: Double; const circ: Circle): Boolean
Bitmap Collision
Bitmap Collision
Check if two bitmaps collide.
Parameters:
Name | Type | Description |
---|---|---|
bmp1 | Bitmap | The first bitmap |
x1 | Double | The x location where the first bitmap is drawn |
y1 | Double | The y location where the first bitmap is drawn |
bmp2 | Bitmap | The second bitmap |
x2 | Double | The x location where the second bitmap is drawn |
y2 | Double | The y location where the second bitmap is drawn |
Return Type: Boolean
Signatures:
bool bitmap_collision(bitmap bmp1, double x1, double y1, bitmap bmp2, double x2, double y2)
public bool Bitmap.BitmapCollision(double x1, double y1, Bitmap bmp2, double x2, double y2);public static bool SplashKit.BitmapCollision(Bitmap bmp1, double x1, double y1, Bitmap bmp2, double x2, double y2);
def bitmap_collision(bmp1, x1, y1, bmp2, x2, y2):
function BitmapCollision(bmp1: Bitmap; x1: Double; y1: Double; bmp2: Bitmap; x2: Double; y2: Double): Boolean
Bitmap Collision
Check if two bitmaps collide.
Parameters:
Name | Type | Description |
---|---|---|
bmp1 | Bitmap | The first bitmap |
pt1 | Point 2d | The point where bitmap 1 is drawn |
bmp2 | Bitmap | The second bitmap |
pt2 | Point 2d | The point where bitmap 2 is drawn |
Return Type: Boolean
Signatures:
bool bitmap_collision(bitmap bmp1, const point_2d &pt1, bitmap bmp2, const point_2d &pt2)
public bool Bitmap.BitmapCollision(Point2D pt1, Bitmap bmp2, Point2D pt2);public static bool SplashKit.BitmapCollision(Bitmap bmp1, Point2D pt1, Bitmap bmp2, Point2D pt2);
def bitmap_collision_at_points(bmp1, pt1, bmp2, pt2):
function BitmapCollision(bmp1: Bitmap; const pt1: Point2D; bmp2: Bitmap; const pt2: Point2D): Boolean
Bitmap Collision
Check if two bitmaps collide, based on their cell and transform matricies.
Parameters:
Name | Type | Description |
---|---|---|
bmp1 | Bitmap | The first bitmap |
cell1 | Integer | The cell of the first bitmap. |
matrix1 | Matrix 2d | The transformation for the first matrix |
bmp2 | Bitmap | The second bitmap |
cell2 | Integer | The cell of the second bitmap. |
matrix2 | Matrix 2d | The transformation for the second matrix |
Return Type: Boolean
Signatures:
bool bitmap_collision(bitmap bmp1, int cell1, const matrix_2d &matrix1, bitmap bmp2, int cell2, const matrix_2d &matrix2)
public bool Bitmap.BitmapCollision(int cell1, Matrix2D matrix1, Bitmap bmp2, int cell2, Matrix2D matrix2);public static bool SplashKit.BitmapCollision(Bitmap bmp1, int cell1, Matrix2D matrix1, Bitmap bmp2, int cell2, Matrix2D matrix2);
def bitmap_collision_for_cells_with_translations(bmp1, cell1, matrix1, bmp2, cell2, matrix2):
function BitmapCollision(bmp1: Bitmap; cell1: Integer; const matrix1: Matrix2D; bmp2: Bitmap; cell2: Integer; const matrix2: Matrix2D): Boolean
Bitmap Collision
Check if two bitmaps collide.
Parameters:
Name | Type | Description |
---|---|---|
bmp1 | Bitmap | The first bitmap |
cell1 | Integer | The cell of the first bitmap. |
pt1 | Point 2d | The point where bitmap 1 is drawn |
bmp2 | Bitmap | The second bitmap |
cell2 | Integer | The cell of the second bitmap. |
pt2 | Point 2d | The point where bitmap 2 is drawn |
Return Type: Boolean
Signatures:
bool bitmap_collision(bitmap bmp1, int cell1, const point_2d &pt1, bitmap bmp2, int cell2, const point_2d &pt2)
public bool Bitmap.BitmapCollision(int cell1, Point2D pt1, Bitmap bmp2, int cell2, Point2D pt2);public static bool SplashKit.BitmapCollision(Bitmap bmp1, int cell1, Point2D pt1, Bitmap bmp2, int cell2, Point2D pt2);
def bitmap_collision_for_cells_at_points(bmp1, cell1, pt1, bmp2, cell2, pt2):
function BitmapCollision(bmp1: Bitmap; cell1: Integer; const pt1: Point2D; bmp2: Bitmap; cell2: Integer; const pt2: Point2D): Boolean
Bitmap Collision
Check if two bitmaps collide.
Parameters:
Name | Type | Description |
---|---|---|
bmp1 | Bitmap | The first bitmap |
cell1 | Integer | The cell of the first bitmap. |
x1 | Double | The x location where the first bitmap is drawn |
y1 | Double | The y location where the first bitmap is drawn |
bmp2 | Bitmap | The second bitmap |
cell2 | Integer | The cell of the second bitmap. |
x2 | Double | The x location where the second bitmap is drawn |
y2 | Double | The y location where the second bitmap is drawn |
Return Type: Boolean
Signatures:
bool bitmap_collision(bitmap bmp1, int cell1, double x1, double y1, bitmap bmp2, int cell2, double x2, double y2)
public bool Bitmap.BitmapCollision(int cell1, double x1, double y1, Bitmap bmp2, int cell2, double x2, double y2);public static bool SplashKit.BitmapCollision(Bitmap bmp1, int cell1, double x1, double y1, Bitmap bmp2, int cell2, double x2, double y2);
def bitmap_collision_for_cells(bmp1, cell1, x1, y1, bmp2, cell2, x2, y2):
function BitmapCollision(bmp1: Bitmap; cell1: Integer; x1: Double; y1: Double; bmp2: Bitmap; cell2: Integer; x2: Double; y2: Double): Boolean
Bitmap Point Collision
Bitmap Point Collision
Tests if a bitmap drawn using the passed in translation matrix would draw a pixel at the passed in point. Use to check collisions between a point and a bitmap.
Parameters:
Name | Type | Description |
---|---|---|
bmp | Bitmap | The bitmap to test. |
translation | Matrix 2d | The translation matrix that represents the position, scale, and rotation of the bitmap when it is drawn. |
pt | Point 2d | The point in the resulting drawing that is being tested. |
Return Type: Boolean
Signatures:
bool bitmap_point_collision(bitmap bmp, const matrix_2d &translation, const point_2d &pt)
public bool Bitmap.PointCollision(Matrix2D translation, Point2D pt);public static bool SplashKit.BitmapPointCollision(Bitmap bmp, Matrix2D translation, Point2D pt);
def bitmap_point_collision_with_translation(bmp, translation, pt):
function BitmapPointCollision(bmp: Bitmap; const translation: Matrix2D; const pt: Point2D): Boolean
Bitmap Point Collision
Tests if a bitmap drawn at the bmp_pt
point would draw a pixel at point pt
. Use to check collisions between a point and a bitmap.
Parameters:
Name | Type | Description |
---|---|---|
bmp | Bitmap | The bitmap to test. |
bmp_pt | Point 2d | The point where the bitmap is drawn. |
pt | Point 2d | The point in the resulting drawing that is being tested. |
Return Type: Boolean
Signatures:
bool bitmap_point_collision(bitmap bmp, const point_2d &bmp_pt, const point_2d &pt)
public bool Bitmap.PointCollision(Point2D bmpPt, Point2D pt);public static bool SplashKit.BitmapPointCollision(Bitmap bmp, Point2D bmpPt, Point2D pt);
def bitmap_point_collision_at_point(bmp, bmp_pt, pt):
function BitmapPointCollision(bmp: Bitmap; const bmpPt: Point2D; const pt: Point2D): Boolean
Bitmap Point Collision
Tests if a bitmap drawn at x,y would draw a pixel at the passed in point. Use to check collisions between a point and a bitmap.
Parameters:
Name | Type | Description |
---|---|---|
bmp | Bitmap | The bitmap to test. |
bmp_x | Double | The x location where the bitmap is drawn |
bmp_y | Double | The y location where the bitmap is drawn |
x | Double | The x location of the point to test |
y | Double | The y location of the point to test |
Return Type: Boolean
Signatures:
bool bitmap_point_collision(bitmap bmp, double bmp_x, double bmp_y, double x, double y)
public bool Bitmap.PointCollision(double bmpX, double bmpY, double x, double y);public static bool SplashKit.BitmapPointCollision(Bitmap bmp, double bmpX, double bmpY, double x, double y);
def bitmap_point_collision(bmp, bmp_x, bmp_y, x, y):
function BitmapPointCollision(bmp: Bitmap; bmpX: Double; bmpY: Double; x: Double; y: Double): Boolean
Bitmap Point Collision
Tests if a bitmap cell drawn using the passed in translation matrix would draw a pixel at the passed in point.
Parameters:
Name | Type | Description |
---|---|---|
bmp | Bitmap | The bitmap to test. |
cell | Integer | The cell of the bitmap to check. |
translation | Matrix 2d | The translation matrix that represents the position, scale, and rotation of the bitmap when it is drawn. |
pt | Point 2d | The point in the resulting drawing that is being tested. |
Return Type: Boolean
Signatures:
bool bitmap_point_collision(bitmap bmp, int cell, const matrix_2d &translation, const point_2d &pt)
public bool Bitmap.PointCollision(int cell, Matrix2D translation, Point2D pt);public static bool SplashKit.BitmapPointCollision(Bitmap bmp, int cell, Matrix2D translation, Point2D pt);
def bitmap_point_collision_for_cell_with_translation(bmp, cell, translation, pt):
function BitmapPointCollision(bmp: Bitmap; cell: Integer; const translation: Matrix2D; const pt: Point2D): Boolean
Bitmap Point Collision
Tests if a cell of a bitmap drawn at x,y would draw a pixel at the passed in point. Use to check collisions between a point and a bitmap.
Parameters:
Name | Type | Description |
---|---|---|
bmp | Bitmap | The bitmap to test |
cell | Integer | The cell of the bitmap to test |
bmp_pt | Point 2d | The point where the bitmap is drawn. |
pt | Point 2d | The point in the resulting drawing that is being tested. |
Return Type: Boolean
Signatures:
bool bitmap_point_collision(bitmap bmp, int cell, const point_2d &bmp_pt, const point_2d &pt)
public bool Bitmap.PointCollision(int cell, Point2D bmpPt, Point2D pt);public static bool SplashKit.BitmapPointCollision(Bitmap bmp, int cell, Point2D bmpPt, Point2D pt);
def bitmap_point_collision_for_cell_at_point(bmp, cell, bmp_pt, pt):
function BitmapPointCollision(bmp: Bitmap; cell: Integer; const bmpPt: Point2D; const pt: Point2D): Boolean
Bitmap Point Collision
Tests if a cell of a bitmap drawn at x,y would draw a pixel at the passed in point. Use to check collisions between a point and a bitmap.
Parameters:
Name | Type | Description |
---|---|---|
bmp | Bitmap | The bitmap to test |
cell | Integer | The cell of the bitmap to test |
bmp_x | Double | The x location where the bitmap is drawn |
bmp_y | Double | The y location where the bitmap is drawn |
x | Double | The x location of the point to test |
y | Double | The y location of the point to test |
Return Type: Boolean
Signatures:
bool bitmap_point_collision(bitmap bmp, int cell, double bmp_x, double bmp_y, double x, double y)
public bool Bitmap.PointCollision(int cell, double bmpX, double bmpY, double x, double y);public static bool SplashKit.BitmapPointCollision(Bitmap bmp, int cell, double bmpX, double bmpY, double x, double y);
def bitmap_point_collision_for_cell(bmp, cell, bmp_x, bmp_y, x, y):
function BitmapPointCollision(bmp: Bitmap; cell: Integer; bmpX: Double; bmpY: Double; x: Double; y: Double): Boolean
Bitmap Quad Collision
Tests if a bitmap cell drawn using a passed in translation, will intersect with a quad. You can use this to detect collisions between bitmaps and quads.
Parameters:
Name | Type | Description |
---|---|---|
bmp | Bitmap | The bitmap to test |
cell | Integer | The cell of the bitmap to check |
translation | Matrix 2d | The matrix used to transfrom the bitmap when drawing |
q | Quad | The quad to test |
Return Type: Boolean
Signatures:
bool bitmap_quad_collision(bitmap bmp, int cell, const matrix_2d &translation, const quad &q)
public bool Bitmap.QuadCollision(int cell, Matrix2D translation, Quad q);public static bool SplashKit.BitmapQuadCollision(Bitmap bmp, int cell, Matrix2D translation, Quad q);
def bitmap_quad_collision_for_cell_with_translation(bmp, cell, translation, q):
function BitmapQuadCollision(bmp: Bitmap; cell: Integer; const translation: Matrix2D; const q: Quad): Boolean
Bitmap Ray Collision
Bitmap Ray Collision
Tests if a bitmap drawn at pt
would intersect with a ray.
Parameters:
Name | Type | Description |
---|---|---|
bmp | Bitmap | The bitmap to test |
pt | Point 2d | The location where the bitmap is drawn |
origin | Point 2d | The origin of the ray |
heading | Vector 2d | The heading of the ray |
Return Type: Boolean
Signatures:
bool bitmap_ray_collision(bitmap bmp, const point_2d &pt, const point_2d &origin, const vector_2d &heading)
public bool Bitmap.RayCollision(Point2D pt, Point2D origin, Vector2D heading);public static bool SplashKit.BitmapRayCollision(Bitmap bmp, Point2D pt, Point2D origin, Vector2D heading);
def bitmap_ray_collision_at_point(bmp, pt, origin, heading):
function BitmapRayCollision(bmp: Bitmap; const pt: Point2D; const origin: Point2D; const heading: Vector2D): Boolean
Bitmap Ray Collision
Tests if a bitmap drawn at x
, y
would intersect with a ray.
Parameters:
Name | Type | Description |
---|---|---|
bmp | Bitmap | The bitmap to test |
x | Double | The x location where the bitmap is drawn |
y | Double | The y location where the bitmap is drawn |
origin | Point 2d | The origin of the ray |
heading | Vector 2d | The heading of the ray |
Return Type: Boolean
Signatures:
bool bitmap_ray_collision(bitmap bmp, double x, double y, const point_2d &origin, const vector_2d &heading)
public bool Bitmap.RayCollision(double x, double y, Point2D origin, Vector2D heading);public static bool SplashKit.BitmapRayCollision(Bitmap bmp, double x, double y, Point2D origin, Vector2D heading);
def bitmap_ray_collision(bmp, x, y, origin, heading):
function BitmapRayCollision(bmp: Bitmap; x: Double; y: Double; const origin: Point2D; const heading: Vector2D): Boolean
Bitmap Ray Collision
Tests if a bitmap cell drawn using a passed in translation, will intersect with a ray. You can use this to detect collisions between bitmaps and rays.
Parameters:
Name | Type | Description |
---|---|---|
bmp | Bitmap | The bitmap to test |
cell | Integer | The cell of the bitmap to check |
translation | Matrix 2d | The matrix used to transfrom the bitmap when drawing |
origin | Point 2d | The origin of the ray |
heading | Vector 2d | The heading of the ray |
Return Type: Boolean
Signatures:
bool bitmap_ray_collision(bitmap bmp, int cell, const matrix_2d &translation, const point_2d &origin, const vector_2d &heading)
public bool Bitmap.RayCollision(int cell, Matrix2D translation, Point2D origin, Vector2D heading);public static bool SplashKit.BitmapRayCollision(Bitmap bmp, int cell, Matrix2D translation, Point2D origin, Vector2D heading);
def bitmap_ray_collision_for_cell_with_translation(bmp, cell, translation, origin, heading):
function BitmapRayCollision(bmp: Bitmap; cell: Integer; const translation: Matrix2D; const origin: Point2D; const heading: Vector2D): Boolean
Bitmap Ray Collision
Tests if a bitmap cell drawn at pt
would intersect with a ray.
Parameters:
Name | Type | Description |
---|---|---|
bmp | Bitmap | The bitmap to test |
cell | Integer | The cell of the bitmap to check |
pt | Point 2d | The location where the bitmap is drawn |
origin | Point 2d | The origin of the ray |
heading | Vector 2d | The heading of the ray |
Return Type: Boolean
Signatures:
bool bitmap_ray_collision(bitmap bmp, int cell, const point_2d &pt, const point_2d &origin, const vector_2d &heading)
public bool Bitmap.RayCollision(int cell, Point2D pt, Point2D origin, Vector2D heading);public static bool SplashKit.BitmapRayCollision(Bitmap bmp, int cell, Point2D pt, Point2D origin, Vector2D heading);
def bitmap_ray_collision_for_cell_at_point(bmp, cell, pt, origin, heading):
function BitmapRayCollision(bmp: Bitmap; cell: Integer; const pt: Point2D; const origin: Point2D; const heading: Vector2D): Boolean
Bitmap Ray Collision
Tests if a bitmap cell drawn at x
, y
would intersect with a ray.
Parameters:
Name | Type | Description |
---|---|---|
bmp | Bitmap | The bitmap to test |
cell | Integer | The cell of the bitmap to check |
x | Double | The x location where the bitmap is drawn |
y | Double | The y location where the bitmap is drawn |
origin | Point 2d | The origin of the ray |
heading | Vector 2d | The heading of the ray |
Return Type: Boolean
Signatures:
bool bitmap_ray_collision(bitmap bmp, int cell, double x, double y, const point_2d &origin, const vector_2d &heading)
public bool Bitmap.RayCollision(int cell, double x, double y, Point2D origin, Vector2D heading);public static bool SplashKit.BitmapRayCollision(Bitmap bmp, int cell, double x, double y, Point2D origin, Vector2D heading);
def bitmap_ray_collision_for_cell(bmp, cell, x, y, origin, heading):
function BitmapRayCollision(bmp: Bitmap; cell: Integer; x: Double; y: Double; const origin: Point2D; const heading: Vector2D): Boolean
Bitmap Rectangle Collision
Bitmap Rectangle Collision
Tests if a bitmap drawn at pt
would intersect with a rectangle.
Parameters:
Name | Type | Description |
---|---|---|
bmp | Bitmap | The bitmap to test |
pt | Point 2d | The location where the bitmap is drawn |
rect | Rectangle | The rectangle to test |
Return Type: Boolean
Signatures:
bool bitmap_rectangle_collision(bitmap bmp, const point_2d &pt, const rectangle &rect)
public bool Bitmap.RectangleCollision(Point2D pt, Rectangle rect);public static bool SplashKit.BitmapRectangleCollision(Bitmap bmp, Point2D pt, Rectangle rect);
def bitmap_rectangle_collision_at_point(bmp, pt, rect):
function BitmapRectangleCollision(bmp: Bitmap; const pt: Point2D; const rect: Rectangle): Boolean
Bitmap Rectangle Collision
Tests if a bitmap drawn at x
, y
would intersect with a rectangle.
Parameters:
Name | Type | Description |
---|---|---|
bmp | Bitmap | The bitmap to test |
x | Double | The x location where the bitmap is drawn |
y | Double | The y location where the bitmap is drawn |
rect | Rectangle | The rectangle to test |
Return Type: Boolean
Signatures:
bool bitmap_rectangle_collision(bitmap bmp, double x, double y, const rectangle &rect)
public bool Bitmap.RectangleCollision(double x, double y, Rectangle rect);public static bool SplashKit.BitmapRectangleCollision(Bitmap bmp, double x, double y, Rectangle rect);
def bitmap_rectangle_collision(bmp, x, y, rect):
function BitmapRectangleCollision(bmp: Bitmap; x: Double; y: Double; const rect: Rectangle): Boolean
Bitmap Rectangle Collision
Tests if a bitmap cell drawn using a passed in translation, will intersect with a rectangle. You can use this to detect collisions between bitmaps and rectangles.
Parameters:
Name | Type | Description |
---|---|---|
bmp | Bitmap | The bitmap to test |
cell | Integer | The cell of the bitmap to check |
translation | Matrix 2d | The matrix used to transfrom the bitmap when drawing |
rect | Rectangle | The rectangle to test |
Return Type: Boolean
Signatures:
bool bitmap_rectangle_collision(bitmap bmp, int cell, const matrix_2d &translation, const rectangle &rect)
public bool Bitmap.RectangleCollision(int cell, Matrix2D translation, Rectangle rect);public static bool SplashKit.BitmapRectangleCollision(Bitmap bmp, int cell, Matrix2D translation, Rectangle rect);
def bitmap_rectangle_collision_for_cell_with_translation(bmp, cell, translation, rect):
function BitmapRectangleCollision(bmp: Bitmap; cell: Integer; const translation: Matrix2D; const rect: Rectangle): Boolean
Bitmap Rectangle Collision
Tests if a bitmap cell drawn at pt
would intersect with a rectangle.
Parameters:
Name | Type | Description |
---|---|---|
bmp | Bitmap | The bitmap to test |
cell | Integer | The cell of the bitmap to check |
pt | Point 2d | The location where the bitmap is drawn |
rect | Rectangle | The rectangle to test |
Return Type: Boolean
Signatures:
bool bitmap_rectangle_collision(bitmap bmp, int cell, const point_2d &pt, const rectangle &rect)
public bool Bitmap.RectangleCollision(int cell, Point2D pt, Rectangle rect);public static bool SplashKit.BitmapRectangleCollision(Bitmap bmp, int cell, Point2D pt, Rectangle rect);
def bitmap_rectangle_collision_for_cell_at_point(bmp, cell, pt, rect):
function BitmapRectangleCollision(bmp: Bitmap; cell: Integer; const pt: Point2D; const rect: Rectangle): Boolean
Bitmap Rectangle Collision
Tests if a cell of the bitmap drawn at x
, y
would intersect with a rectangle.
Parameters:
Name | Type | Description |
---|---|---|
bmp | Bitmap | The bitmap to test |
cell | Integer | The cell of the bitmap to check |
x | Double | The x location where the bitmap is drawn |
y | Double | The y location where the bitmap is drawn |
rect | Rectangle | The rectangle to test |
Return Type: Boolean
Signatures:
bool bitmap_rectangle_collision(bitmap bmp, int cell, double x, double y, const rectangle &rect)
public bool Bitmap.RectangleCollision(int cell, double x, double y, Rectangle rect);public static bool SplashKit.BitmapRectangleCollision(Bitmap bmp, int cell, double x, double y, Rectangle rect);
def bitmap_rectangle_collision_for_cell(bmp, cell, x, y, rect):
function BitmapRectangleCollision(bmp: Bitmap; cell: Integer; x: Double; y: Double; const rect: Rectangle): Boolean
Sprite Bitmap Collision
Sprite Bitmap Collision
Tests if a sprite will collide with a bitmap drawn at the indicated location.
Parameters:
Name | Type | Description |
---|---|---|
s | Sprite | The sprite to test |
bmp | Bitmap | The bitmap to test |
x | Double | The x location where the bitmap is drawn |
y | Double | The y location where the bitmap is drawn |
Return Type: Boolean
Signatures:
bool sprite_bitmap_collision(sprite s, bitmap bmp, double x, double y)
public bool Sprite.BitmapCollision(Bitmap bmp, double x, double y);public static bool SplashKit.SpriteBitmapCollision(Sprite s, Bitmap bmp, double x, double y);
def sprite_bitmap_collision(s, bmp, x, y):
function SpriteBitmapCollision(s: Sprite; bmp: Bitmap; x: Double; y: Double): Boolean
Usage:
Sprite Bitmap Collision
Tests if a sprite will collide with a bitmap drawn at the indicated location.
Parameters:
Name | Type | Description |
---|---|---|
s | Sprite | The sprite to test |
bmp | Bitmap | The bitmap to test |
cell | Integer | The cell of the bitmap to check |
pt | Point 2d | The point where the bitmap is drawn |
Return Type: Boolean
Signatures:
bool sprite_bitmap_collision(sprite s, bitmap bmp, int cell, const point_2d &pt)
public bool Sprite.BitmapCollision(Bitmap bmp, int cell, Point2D pt);public static bool SplashKit.SpriteBitmapCollision(Sprite s, Bitmap bmp, int cell, Point2D pt);
def sprite_bitmap_collision_with_cell_at_point(s, bmp, cell, pt):
function SpriteBitmapCollision(s: Sprite; bmp: Bitmap; cell: Integer; const pt: Point2D): Boolean
Sprite Bitmap Collision
Tests if a sprite will collide with a bitmap drawn at the indicated location.
Parameters:
Name | Type | Description |
---|---|---|
s | Sprite | The sprite to test |
bmp | Bitmap | The bitmap to test |
cell | Integer | The cell of the bitmap to check |
x | Double | The x location where the bitmap is drawn |
y | Double | The y location where the bitmap is drawn |
Return Type: Boolean
Signatures:
bool sprite_bitmap_collision(sprite s, bitmap bmp, int cell, double x, double y)
public bool Sprite.BitmapCollision(Bitmap bmp, int cell, double x, double y);public static bool SplashKit.SpriteBitmapCollision(Sprite s, Bitmap bmp, int cell, double x, double y);
def sprite_bitmap_collision_with_cell(s, bmp, cell, x, y):
function SpriteBitmapCollision(s: Sprite; bmp: Bitmap; cell: Integer; x: Double; y: Double): Boolean
Sprite Collision
Tests if two given sprites s1
and s2
are collided
Parameters:
Name | Type | Description |
---|---|---|
s1 | Sprite | the first Sprite to test |
s2 | Sprite | the second Sprite to test |
Return Type: Boolean
Signatures:
bool sprite_collision(sprite s1, sprite s2)
public bool Sprite.SpriteCollision(Sprite s2);public static bool SplashKit.SpriteCollision(Sprite s1, Sprite s2);
def sprite_collision(s1, s2):
function SpriteCollision(s1: Sprite; s2: Sprite): Boolean
Usage:
Sprite Point Collision
Tests if a sprite is drawn at a given point.
Parameters:
Name | Type | Description |
---|---|---|
s | Sprite | The sprite to test |
pt | Point 2d | The point to check |
Return Type: Boolean
Signatures:
bool sprite_point_collision(sprite s, const point_2d &pt)
public bool Sprite.PointCollision(Point2D pt);public static bool SplashKit.SpritePointCollision(Sprite s, Point2D pt);
def sprite_point_collision(s, pt):
function SpritePointCollision(s: Sprite; const pt: Point2D): Boolean
Usage:
Sprite Ray Collision
Tests if a sprite is drawn along a given ray.
Parameters:
Name | Type | Description |
---|---|---|
s | Sprite | The sprite to test |
origin | Point 2d | The origin of the ray |
heading | Vector 2d | The heading of the ray |
Return Type: Boolean
Signatures:
bool sprite_ray_collision(sprite s, const point_2d &origin, const vector_2d &heading)
public bool Sprite.RayCollision(Point2D origin, Vector2D heading);public static bool SplashKit.SpriteRayCollision(Sprite s, Point2D origin, Vector2D heading);
def sprite_ray_collision(s, origin, heading):
function SpriteRayCollision(s: Sprite; const origin: Point2D; const heading: Vector2D): Boolean
Sprite Rectangle Collision
Tests if a sprite is drawn within an given area (rectangle).
Parameters:
Name | Type | Description |
---|---|---|
s | Sprite | The sprite to test |
rect | Rectangle | The rectangle to check |
Return Type: Boolean
Signatures:
bool sprite_rectangle_collision(sprite s, const rectangle &rect)
public bool Sprite.RectangleCollision(Rectangle rect);public static bool SplashKit.SpriteRectangleCollision(Sprite s, Rectangle rect);
def sprite_rectangle_collision(s, rect):
function SpriteRectangleCollision(s: Sprite; const rect: Rectangle): Boolean
Usage:
Apply Matrix
Apply Matrix
Use a matrix to transform all of the points in a quad.
Parameters:
Name | Type | Description |
---|---|---|
matrix | Matrix 2d | The matrix with the transformations needed. |
q | Quad | The quad to transform. |
Signatures:
void apply_matrix(const matrix_2d &matrix, quad &q)
public static void SplashKit.ApplyMatrix(Matrix2D matrix, ref Quad q);
def apply_matrix_to_quad(matrix, q):
procedure ApplyMatrix(const matrix: Matrix2D; var q: Quad)
Apply Matrix
Use a matrix to transform all of the points in a triangle.
Parameters:
Name | Type | Description |
---|---|---|
m | Matrix 2d | The matrix to be applied to the triangle. |
tri | Triangle | The triangle to tranform. |
Signatures:
void apply_matrix(const matrix_2d &m, triangle &tri)
public static void SplashKit.ApplyMatrix(Matrix2D m, ref Triangle tri);
def apply_matrix_to_triangle(m, tri):
procedure ApplyMatrix(const m: Matrix2D; var tri: Triangle)
Identity Matrix
Returns the identity matrix. When a matrix_2d or Vector is multiplied by the identity matrix the result is the original matrix or vector.
Return Type: Matrix 2d
Signatures:
matrix_2d identity_matrix()
public static Matrix2D SplashKit.IdentityMatrix();
def identity_matrix():
function IdentityMatrix(): Matrix2D
Matrix Inverse
Calculate the inverse of a matrix.
Parameters:
Name | Type | Description |
---|---|---|
m | Matrix 2d | The matrix to invert. |
Return Type: Matrix 2d
Signatures:
matrix_2d matrix_inverse(const matrix_2d &m)
public static Matrix2D SplashKit.MatrixInverse(Matrix2D m);
def matrix_inverse(m):
function MatrixInverse(const m: Matrix2D): Matrix2D
Matrix Multiply
Matrix Multiply
Multiplies the Point 2d
parameter v with the [
Matrix 2d](/api/physics/#matrix-2d)
m and returns the result as a Point 2d
. Use this to transform the vector with the matrix (to apply scaling, rotation or translation effects).
Parameters:
Name | Type | Description |
---|---|---|
m | Matrix 2d | The matrix with the transformation to apply. |
pt | Point 2d | The point to be transformed. |
Return Type: Point 2d
Signatures:
point_2d matrix_multiply(const matrix_2d &m, const point_2d &pt)
public static Point2D SplashKit.MatrixMultiply(Matrix2D m, Point2D pt);
def matrix_multiply_point(m, pt):
function MatrixMultiply(const m: Matrix2D; const pt: Point2D): Point2D
Matrix Multiply
Multiplies the two Matrix 2d
parameters, m1
by m2
, and returns the result as a new Matrix 2d
. Use this to combine the effects to two matrix transformations.
Parameters:
Name | Type | Description |
---|---|---|
m1 | Matrix 2d | The first matrix |
m2 | Matrix 2d | The second matrix |
Return Type: Matrix 2d
Signatures:
matrix_2d matrix_multiply(const matrix_2d &m1, const matrix_2d &m2)
public static Matrix2D SplashKit.MatrixMultiply(Matrix2D m1, Matrix2D m2);
def matrix_multiply_matrix(m1, m2):
function MatrixMultiply(const m1: Matrix2D; const m2: Matrix2D): Matrix2D
Matrix Multiply
Multiplies the Vector
parameter v
with the Matrix 2d
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:
Name | Type | Description |
---|---|---|
m | Matrix 2d | The matrix with the transformation to apply. |
v | Vector 2d | The vector to be transformed. |
Return Type: Vector 2d
Signatures:
vector_2d matrix_multiply(const matrix_2d &m, const vector_2d &v)
public static Vector2D SplashKit.MatrixMultiply(Matrix2D m, Vector2D v);
def matrix_multiply_vector(m, v):
function MatrixMultiply(const m: Matrix2D; const v: Vector2D): Vector2D
Matrix To String
This function returns a string representation of a Matrix.
Parameters:
Name | Type | Description |
---|---|---|
matrix | Matrix 2d | The matrix to convert to a string. |
Return Type: String
Signatures:
string matrix_to_string(const matrix_2d &matrix)
public static string SplashKit.MatrixToString(Matrix2D matrix);
def matrix_to_string(matrix):
function MatrixToString(const matrix: Matrix2D): String
Rotation Matrix
Returns a rotation matrix that rotates 2d points by the angle.
Parameters:
Name | Type | Description |
---|---|---|
deg | Double | The amount to rotate points |
Return Type: Matrix 2d
Signatures:
matrix_2d rotation_matrix(double deg)
public static Matrix2D SplashKit.RotationMatrix(double deg);
def rotation_matrix(deg):
function RotationMatrix(deg: Double): Matrix2D
Scale Matrix
Scale Matrix
Create a scale matrix that scales x and y to different degrees.
Parameters:
Name | Type | Description |
---|---|---|
scale | Point 2d | The amount to scale, with separate x and y components. |
Return Type: Matrix 2d
Signatures:
matrix_2d scale_matrix(const point_2d &scale)
public static Matrix2D SplashKit.ScaleMatrix(Point2D scale);
def scale_matrix_from_point(scale):
function ScaleMatrix(const scale: Point2D): Matrix2D
Scale Matrix
Create a scale matrix that scales x and y to different degrees.
Parameters:
Name | Type | Description |
---|---|---|
scale | Vector 2d | The amount to scale, with separate x and y components. |
Return Type: Matrix 2d
Signatures:
matrix_2d scale_matrix(const vector_2d &scale)
public static Matrix2D SplashKit.ScaleMatrix(Vector2D scale);
def scale_matrix_from_vector(scale):
function ScaleMatrix(const scale: Vector2D): Matrix2D
Scale Matrix
Returns a matrix that can be used to scale 2d points (both x and y).
Parameters:
Name | Type | Description |
---|---|---|
scale | Double | The amount to scale points by. |
Return Type: Matrix 2d
Signatures:
matrix_2d scale_matrix(double scale)
public static Matrix2D SplashKit.ScaleMatrix(double scale);
def scale_matrix(scale):
function ScaleMatrix(scale: Double): Matrix2D
Scale Rotate Translate Matrix
Create a matrix that can scale, rotate then translate geometry points.
Parameters:
Name | Type | Description |
---|---|---|
scale | Point 2d | The amount to scale |
deg | Double | The amount to rotate |
translate | Point 2d | The amount to move |
Return Type: Matrix 2d
Signatures:
matrix_2d scale_rotate_translate_matrix(const point_2d &scale, double deg, const point_2d &translate)
public static Matrix2D SplashKit.ScaleRotateTranslateMatrix(Point2D scale, double deg, Point2D translate);
def scale_rotate_translate_matrix(scale, deg, translate):
function ScaleRotateTranslateMatrix(const scale: Point2D; deg: Double; const translate: Point2D): Matrix2D
Translation Matrix
Translation Matrix
Returns a translation matric used to translate 2d points by the distance in the point_2d.
Parameters:
Name | Type | Description |
---|---|---|
pt | Point 2d | The point to translate to. |
Return Type: Matrix 2d
Signatures:
matrix_2d translation_matrix(const point_2d &pt)
public static Matrix2D SplashKit.TranslationMatrix(Point2D pt);
def translation_matrix_to_point(pt):
function TranslationMatrix(const pt: Point2D): Matrix2D
Translation Matrix
Returns a translation matric used to translate 2d points by the distance in the vector_2d.
Parameters:
Name | Type | Description |
---|---|---|
pt | Vector 2d | The point to translate to. |
Return Type: Matrix 2d
Signatures:
matrix_2d translation_matrix(const vector_2d &pt)
public static Matrix2D SplashKit.TranslationMatrix(Vector2D pt);
def translation_matrix_from_vector(pt):
function TranslationMatrix(const pt: Vector2D): Matrix2D
Translation Matrix
Returns a matrix that can be used to translate 2d points. Moving them by dx and dy.
Parameters:
Name | Type | Description |
---|---|---|
dx | Double | The amount to move points along the x axis. |
dy | Double | The amount to move points along the y axis. |
Return Type: Matrix 2d
Signatures:
matrix_2d translation_matrix(double dx, double dy)
public static Matrix2D SplashKit.TranslationMatrix(double dx, double dy);
def translation_matrix(dx, dy):
function TranslationMatrix(dx: Double; dy: Double): Matrix2D
Angle Between
Calculates the angle from one vector to another.
Parameters:
Name | Type | Description |
---|---|---|
v1 | Vector 2d | The first vector |
v2 | Vector 2d | The second vector |
Return Type: Double
Signatures:
double angle_between(const vector_2d &v1, const vector_2d &v2)
public static double SplashKit.AngleBetween(Vector2D v1, Vector2D v2);
def angle_between(v1, v2):
function AngleBetween(const v1: Vector2D; const v2: Vector2D): Double
Usage:
Dot Product
Calculates the dot product (scalar product) between the two vector parameters provided (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:
Name | Type | Description |
---|---|---|
v1 | Vector 2d | The first vector |
v2 | Vector 2d | The other vector |
Return Type: Double
Signatures:
double dot_product(const vector_2d &v1, const vector_2d &v2)
public static double SplashKit.DotProduct(Vector2D v1, Vector2D v2);
def dot_product(v1, v2):
function DotProduct(const v1: Vector2D; const v2: Vector2D): Double
Usage:
Is Zero Vector
Returns if the vector is a null/zero vector — having no size or direction.
Parameters:
Name | Type | Description |
---|---|---|
v | Vector 2d | The vector |
Return Type: Boolean
Signatures:
bool is_zero_vector(const vector_2d &v)
public static bool SplashKit.IsZeroVector(Vector2D v);
def is_zero_vector(v):
function IsZeroVector(const v: Vector2D): Boolean
Ray Intersection Point
Casts a ray in a heading and returns true is it intersects with a line
Parameters:
Name | Type | Description |
---|---|---|
from_pt | Point 2d | The origin of the ray |
heading | Vector 2d | The direction the ray is heading (as a Vector 2d ) |
l | Line | The line to be checked |
pt | Point 2d | Outputs the point where the line and ray intersect |
Return Type: Boolean
Signatures:
bool ray_intersection_point(const point_2d &from_pt, const vector_2d &heading, const line &l, point_2d &pt)
public static bool SplashKit.RayIntersectionPoint(Point2D fromPt, Vector2D heading, Line l, ref Point2D pt);
def ray_intersection_point(from_pt, heading, l, pt):
function RayIntersectionPoint(const fromPt: Point2D; const heading: Vector2D; const l: Line; var pt: Point2D): 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.
Parameters:
Name | Type | Description |
---|---|---|
v | Vector 2d | The vector |
Return Type: Vector 2d
Signatures:
vector_2d unit_vector(const vector_2d &v)
public static Vector2D SplashKit.UnitVector(Vector2D v);
def unit_vector(v):
function UnitVector(const v: Vector2D): Vector2D
Usage:
Vector Add
Adds the two passed in vectors returns the result as new Vector 2d
.
Parameters:
Name | Type | Description |
---|---|---|
v1 | Vector 2d | The first vector. |
v2 | Vector 2d | The other vector. |
Return Type: Vector 2d
Signatures:
vector_2d vector_add(const vector_2d &v1, const vector_2d &v2)
public static Vector2D SplashKit.VectorAdd(Vector2D v1, Vector2D v2);
def vector_add(v1, v2):
function VectorAdd(const v1: Vector2D; const v2: Vector2D): Vector2D
Usage:
Vector Angle
Calculates the angle of a vector
Parameters:
Name | Type | Description |
---|---|---|
v | Vector 2d | The vector |
Return Type: Double
Signatures:
double vector_angle(const vector_2d v)
public static double SplashKit.VectorAngle(Vector2D v);
def vector_angle(v):
function VectorAngle(v: Vector2D): Double
Usage:
Vector From Angle
Returns a Vector 2d
from the supplied angle and distance.
Parameters:
Name | Type | Description |
---|---|---|
angle | Double | The angle in degrees |
magnitude | Double | The length of the vector |
Return Type: Vector 2d
Signatures:
vector_2d vector_from_angle(double angle, double magnitude)
public static Vector2D SplashKit.VectorFromAngle(double angle, double magnitude);
def vector_from_angle(angle, magnitude):
function VectorFromAngle(angle: Double; magnitude: Double): Vector2D
Usage:
Vector From Line
Returns a vector that points from the start to the end of a line.
Parameters:
Name | Type | Description |
---|---|---|
l | Line | The line |
Return Type: Vector 2d
Signatures:
vector_2d vector_from_line(const line &l)
public static Vector2D SplashKit.VectorFromLine(Line l);
def vector_from_line(l):
function VectorFromLine(const l: Line): Vector2D
Vector From Point To Rect
Returns a vector from a point to a rectangle.
Parameters:
Name | Type | Description |
---|---|---|
pt | Point 2d | The point |
rect | Rectangle | The rectangle |
Return Type: Vector 2d
Signatures:
vector_2d vector_from_point_to_rect(const point_2d &pt, const rectangle &rect)
public static Vector2D SplashKit.VectorFromPointToRect(Point2D pt, Rectangle rect);
def vector_from_point_to_rect(pt, rect):
function VectorFromPointToRect(const pt: Point2D; const rect: Rectangle): Vector2D
Vector In Rect
Returns true if the resulting vector would end in the rectangle if placed at the origin.
Parameters:
Name | Type | Description |
---|---|---|
v | Vector 2d | The vector |
rect | Rectangle | The rectangle |
Return Type: Boolean
Signatures:
bool vector_in_rect(const vector_2d &v, const rectangle &rect)
public static bool SplashKit.VectorInRect(Vector2D v, Rectangle rect);
def vector_in_rect(v, rect):
function VectorInRect(const v: Vector2D; const rect: Rectangle): Boolean
Vector Invert
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:
Name | Type | Description |
---|---|---|
v | Vector 2d | The vector |
Return Type: Vector 2d
Signatures:
vector_2d vector_invert(const vector_2d &v)
public static Vector2D SplashKit.VectorInvert(Vector2D v);
def vector_invert(v):
function VectorInvert(const v: Vector2D): Vector2D
Usage:
Vector Limit
Returns a scaled vector that ensures the new vector points in the same direction as v, but has a magnitude that is limited to the length specified in the limit prameter.
Parameters:
Name | Type | Description |
---|---|---|
v | Vector 2d | The vector |
limit | Double | Its maximum magnitude |
Return Type: Vector 2d
Signatures:
vector_2d vector_limit(const vector_2d &v, double limit)
public static Vector2D SplashKit.VectorLimit(Vector2D v, double limit);
def vector_limit(v, limit):
function VectorLimit(const v: Vector2D; limit: Double): Vector2D
Vector Magnitude
Returns the magnitude (or “length”) of the vector.
Parameters:
Name | Type | Description |
---|---|---|
v | Vector 2d | The vector |
Return Type: Double
Signatures:
double vector_magnitude(const vector_2d &v)
public static double SplashKit.VectorMagnitude(Vector2D v);
def vector_magnitude(v):
function VectorMagnitude(const v: Vector2D): Double
Usage:
Vector Magnitude Squared
Returns the squared magnitude (or “length”) of the vector.
Parameters:
Name | Type | Description |
---|---|---|
v | Vector 2d | The vector |
Return Type: Double
Signatures:
double vector_magnitude_squared(const vector_2d &v)
public static double SplashKit.VectorMagnitudeSquared(Vector2D v);
def vector_magnitude_squared(v):
function VectorMagnitudeSquared(const v: Vector2D): Double
Usage:
Vector Multiply
Multiplies the vector by the passed in value.
Parameters:
Name | Type | Description |
---|---|---|
v1 | Vector 2d | The original vector |
s | Double | The amount to multiply by |
Return Type: Vector 2d
Signatures:
vector_2d vector_multiply(const vector_2d &v1, double s)
public static Vector2D SplashKit.VectorMultiply(Vector2D v1, double s);
def vector_multiply(v1, s):
function VectorMultiply(const v1: Vector2D; s: Double): Vector2D
Usage:
Vector Normal
Returns a new Vector 2d
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. Note: when passed a zero or null vector (a vector with no magnitude or direction) then this function returns a zero/null vector.
Parameters:
Name | Type | Description |
---|---|---|
v | Vector 2d | The vector |
Return Type: Vector 2d
Signatures:
vector_2d vector_normal(const vector_2d &v)
public static Vector2D SplashKit.VectorNormal(Vector2D v);
def vector_normal(v):
function VectorNormal(const v: Vector2D): Vector2D
Usage:
Vector Out Of Circle From Circle
Returns a vector to back one circle out of another, assuming the first circle was moving at a specified velocity.
Parameters:
Name | Type | Description |
---|---|---|
src | Circle | The circle that is moving |
bounds | Circle | The area you want to move the circle out of |
velocity | Vector 2d | The circle’s velocity |
Return Type: Vector 2d
Signatures:
vector_2d vector_out_of_circle_from_circle(const circle &src, const circle &bounds, const vector_2d &velocity)
public static Vector2D SplashKit.VectorOutOfCircleFromCircle(Circle src, Circle bounds, Vector2D velocity);
def vector_out_of_circle_from_circle(src, bounds, velocity):
function VectorOutOfCircleFromCircle(const src: Circle; const bounds: Circle; const velocity: Vector2D): Vector2D
Vector Out Of Circle From Point
Returns the vector out to move a point back out of a circle, given the point was moving at the specified velocity.
Parameters:
Name | Type | Description |
---|---|---|
pt | Point 2d | The point that is moving |
c | Circle | The circle you want to move the point out of |
velocity | Vector 2d | The point’s velocity |
Return Type: Vector 2d
Signatures:
vector_2d vector_out_of_circle_from_point(const point_2d &pt, const circle &c, const vector_2d &velocity)
public static Vector2D SplashKit.VectorOutOfCircleFromPoint(Point2D pt, Circle c, Vector2D velocity);
def vector_out_of_circle_from_point(pt, c, velocity):
function VectorOutOfCircleFromPoint(const pt: Point2D; const c: Circle; const velocity: Vector2D): Vector2D
Vector Out Of Rect From Circle
Returns a vector that can be used to move a circle back out of a rectangle, given that the circle is moving at the specified velocity.
Parameters:
Name | Type | Description |
---|---|---|
c | Circle | The circle that is moving |
rect | Rectangle | The area you wan to move the circle out of |
velocity | Vector 2d | The circle’s velocity |
Return Type: Vector 2d
Signatures:
vector_2d vector_out_of_rect_from_circle(const circle &c, const rectangle &rect, const vector_2d &velocity)
public static Vector2D SplashKit.VectorOutOfRectFromCircle(Circle c, Rectangle rect, Vector2D velocity);
def vector_out_of_rect_from_circle(c, rect, velocity):
function VectorOutOfRectFromCircle(const c: Circle; const rect: Rectangle; const velocity: Vector2D): Vector2D
Vector Out Of Rect From Point
Determines the vector needed to move back from point pt
out of rectangle rect
given the point was moving at the velocity specified.
Parameters:
Name | Type | Description |
---|---|---|
pt | Point 2d | The point you want to move out of a rectangle |
rect | Rectangle | The rectangle to move out of |
velocity | Vector 2d | The velocity of the point. This is used to determine where the point should return to. |
Return Type: Vector 2d
Signatures:
vector_2d vector_out_of_rect_from_point(const point_2d &pt, const rectangle &rect, const vector_2d &velocity)
public static Vector2D SplashKit.VectorOutOfRectFromPoint(Point2D pt, Rectangle rect, Vector2D velocity);
def vector_out_of_rect_from_point(pt, rect, velocity):
function VectorOutOfRectFromPoint(const pt: Point2D; const rect: Rectangle; const velocity: Vector2D): Vector2D
Vector Out Of Rect From Rect
Returns the vector needed to move rectangle src
back out of rectangle bounds
assuming the rectangle was moving at the velocity specified.
Parameters:
Name | Type | Description |
---|---|---|
src | Rectangle | The rectangle you want to move. |
bounds | Rectangle | The area you want to move the rectangle out of |
velocity | Vector 2d | The velocity of the src rectangle |
Return Type: Vector 2d
Signatures:
vector_2d vector_out_of_rect_from_rect(const rectangle &src, const rectangle &bounds, const vector_2d &velocity)
public static Vector2D SplashKit.VectorOutOfRectFromRect(Rectangle src, Rectangle bounds, Vector2D velocity);
def vector_out_of_rect_from_rect(src, bounds, velocity):
function VectorOutOfRectFromRect(const src: Rectangle; const bounds: Rectangle; const velocity: Vector2D): Vector2D
Vector Point To Point
Returns a Vector 2d
created from the difference from the p1
to the second p2
points (Point2D
).
Parameters:
Name | Type | Description |
---|---|---|
start | Point 2d | The starting point |
end_pt | Point 2d | The ending point |
Return Type: Vector 2d
Signatures:
vector_2d vector_point_to_point(const point_2d &start, const point_2d &end_pt)
public static Vector2D SplashKit.VectorPointToPoint(Point2D start, Point2D endPt);
def vector_point_to_point(start, end_pt):
function VectorPointToPoint(const start: Point2D; const endPt: Point2D): Vector2D
Usage:
Vector Subtract
Subtracts the second vector parameter (v2
) from the first vector (v1
) and returns the result as new Vector 2d
.
Parameters:
Name | Type | Description |
---|---|---|
v1 | Vector 2d | The first vector. |
v2 | Vector 2d | The other vector. |
Return Type: Vector 2d
Signatures:
vector_2d vector_subtract(const vector_2d &v1, const vector_2d &v2)
public static Vector2D SplashKit.VectorSubtract(Vector2D v1, Vector2D v2);
def vector_subtract(v1, v2):
function VectorSubtract(const v1: Vector2D; const v2: Vector2D): Vector2D
Usage:
Vector To
Vector To
Returns a new Vector 2d
using the x and y value of a Point 2d
parameter. This is a vector from the origin to that point.
Parameters:
Name | Type | Description |
---|---|---|
p1 | Point 2d | The point |
Return Type: Vector 2d
Signatures:
vector_2d vector_to(const point_2d &p1)
public static Vector2D SplashKit.VectorTo(Point2D p1);
def vector_to_point(p1):
function VectorTo(const p1: Point2D): Vector2D
Vector To
Returns a vector to the indicated point.
Parameters:
Name | Type | Description |
---|---|---|
x | Double | The amount to move horizontally |
y | Double | The amount to move vertically |
Return Type: Vector 2d
Signatures:
vector_2d vector_to(double x, double y)
public static Vector2D SplashKit.VectorTo(double x, double y);
def vector_to(x, y):
function VectorTo(x: Double; y: Double): Vector2D
Usage:
Vector To String
Get a text description of the Vector 2d
.
Parameters:
Name | Type | Description |
---|---|---|
v | Vector 2d | The vector |
Return Type: String
Signatures:
string vector_to_string(const vector_2d &v)
public static string SplashKit.VectorToString(Vector2D v);
def vector_to_string(v):
function VectorToString(const v: Vector2D): String
Usage:
Vectors Equal
Determines if two vectors are the same.
Parameters:
Name | Type | Description |
---|---|---|
v1 | Vector 2d | The first vector |
v2 | Vector 2d | The other vector |
Return Type: Boolean
Signatures:
bool vectors_equal(const vector_2d &v1, const vector_2d v2)
public static bool SplashKit.VectorsEqual(Vector2D v1, Vector2D v2);
def vectors_equal(v1, v2):
function VectorsEqual(const v1: Vector2D; v2: Vector2D): Boolean
Vectors Not Equal
Determines if two vectors are not the same.
Parameters:
Name | Type | Description |
---|---|---|
v1 | Vector 2d | The first vector |
v2 | Vector 2d | The other vector |
Return Type: Boolean
Signatures:
bool vectors_not_equal(const vector_2d &v1, const vector_2d v2)
public static bool SplashKit.VectorsNotEqual(Vector2D v1, Vector2D v2);
def vectors_not_equal(v1, v2):
function VectorsNotEqual(const v1: Vector2D; v2: Vector2D): Boolean
Types
Matrix 2d
Field | Type | Description |
---|---|---|
elements | Double | The elements of the matrix |
In SplashKit, matrices can be used to combine together a number of
operations that need to be performed on Vector 2d
values. You can
translate, rotate and scale, and combine these together into a
single matrix that can then be applied to vectors and points.