Geometry Support#

arcade.calculate_hit_box_points_detailed#

arcade.calculate_hit_box_points_detailed(image: PIL.Image.Image, hit_box_detail: float = 4.5) Union[List[Union[Tuple[float, float], List[float]]], Tuple[Union[Tuple[float, float], List[float]], ...]][source]#

Given an RGBA image, this returns points that make up a hit box around it. Attempts to trim out transparent pixels.

Parameters
  • image (Image) – Image get hit box from.

  • hit_box_detail (int) – How detailed to make the hit box. There’s a trade-off in number of points vs. accuracy.

Returns

List of points

arcade.calculate_hit_box_points_simple#

arcade.calculate_hit_box_points_simple(image: PIL.Image.Image) Union[Tuple[Union[Tuple[float, float], List[float]]], List][source]#

Given an RGBA image, this returns points that make up a hit box around it. Attempts to trim out transparent pixels.

Parameters

image (Image) –

Returns

List of points

arcade.are_polygons_intersecting#

arcade.are_polygons_intersecting(poly_a: Sequence[Union[Tuple[float, float], List[float]]], poly_b: Sequence[Union[Tuple[float, float], List[float]]]) bool[source]#

Return True if two polygons intersect.

Parameters
  • poly_a (PointList) – List of points that define the first polygon.

  • poly_b (PointList) – List of points that define the second polygon.

Returns

True or false depending if polygons intersect

Rtype bool

arcade.is_point_in_polygon#

arcade.is_point_in_polygon(x, y, polygon_point_list)[source]#

Use ray-tracing to see if point is inside a polygon

Args:

x: y: polygon_point_list:

Returns: bool

arcade.EasingData#

class arcade.EasingData(start_period: float, cur_period: float, end_period: float, start_value: float, end_value: float, ease_function: Callable)[source]#

Data class for holding information about easing.

arcade.ease_angle#

arcade.ease_angle(start_angle, end_angle, *, time=None, rate=None, ease_function=<function linear>)[source]#

Set up easing for angles.

arcade.ease_angle_update#

arcade.ease_angle_update(easing_data: arcade.easing.EasingData, delta_time: float) Tuple[source]#

Update angle easing.

arcade.ease_in#

arcade.ease_in(percent: float) float[source]#

Function for quadratic ease-in easing.

arcade.ease_in_back#

arcade.ease_in_back(percent: float) float[source]#

Function for ease_in easing which moves back before moving forward.

arcade.ease_in_out#

arcade.ease_in_out(percent: float) float[source]#

Function for quadratic easing in and out.

arcade.ease_in_out_sin#

arcade.ease_in_out_sin(percent: float) float[source]#

Function for easing in and out using a sin wave

arcade.ease_in_sin#

arcade.ease_in_sin(percent: float) float[source]#

Function for ease_in easing using a sin wave

arcade.ease_out#

arcade.ease_out(percent: float) float[source]#

Function for quadratic ease-out easing.

arcade.ease_out_back#

arcade.ease_out_back(percent: float) float[source]#

Function for ease_out easing which moves back before moving forward.

arcade.ease_out_bounce#

arcade.ease_out_bounce(percent: float) float[source]#

Function for a bouncy ease-out easing.

arcade.ease_out_elastic#

arcade.ease_out_elastic(percent: float) float[source]#

Function for elastic ease-out easing.

arcade.ease_out_sin#

arcade.ease_out_sin(percent: float) float[source]#

Function for ease_out easing using a sin wave

arcade.ease_position#

arcade.ease_position(start_position, end_position, *, time=None, rate=None, ease_function=<function linear>)[source]#

Get an easing position

arcade.ease_update#

arcade.ease_update(easing_data: arcade.easing.EasingData, delta_time: float) Tuple[source]#

Update easing between two values/

arcade.ease_value#

arcade.ease_value(start_value, end_value, *, time=None, rate=None, ease_function=<function linear>)[source]#

Get an easing value

arcade.easing#

arcade.easing(percent: float, easing_data: arcade.easing.EasingData) float[source]#

Function for calculating return value for easing, given percent and easing data.

arcade.linear#

arcade.linear(percent: float) float[source]#

Function for linear easing.

arcade.smoothstep#

arcade.smoothstep(percent: float) float[source]#

Function for smoothstep easing.

arcade.earclip#

arcade.earclip(polygon: Sequence[Union[Tuple[float, float], List[float]]]) List[Tuple[Tuple[float, float], Tuple[float, float], Tuple[float, float]]][source]#

Simple earclipping algorithm for a given polygon p. polygon is expected to be an array of 2-tuples of the cartesian points of the polygon For a polygon with n points it will return n-2 triangles. The triangles are returned as an array of 3-tuples where each item in the tuple is a 2-tuple of the cartesian point.

Implementation Reference:

arcade.clamp#

arcade.clamp(a, low, high)[source]#

Clamp a number between a range.

arcade.get_angle_degrees#

arcade.get_angle_degrees(x1: float, y1: float, x2: float, y2: float) float[source]#

Get the angle in degrees between two points.

Parameters
  • x1 (float) – x coordinate of the first point

  • y1 (float) – y coordinate of the first point

  • x2 (float) – x coordinate of the second point

  • y2 (float) – y coordinate of the second point

arcade.get_angle_radians#

arcade.get_angle_radians(x1: float, y1: float, x2: float, y2: float) float[source]#

Get the angle in radians between two points.

Parameters
  • x1 (float) – x coordinate of the first point

  • y1 (float) – y coordinate of the first point

  • x2 (float) – x coordinate of the second point

  • y2 (float) – y coordinate of the second point

arcade.get_distance#

arcade.get_distance(x1: float, y1: float, x2: float, y2: float)[source]#

Get the distance between two points.

arcade.rotate_point#

arcade.rotate_point(x: float, y: float, cx: float, cy: float, angle_degrees: float) List[float][source]#

Rotate a point around a center.

Parameters
  • x – x value of the point you want to rotate

  • y – y value of the point you want to rotate

  • cx – x value of the center point you want to rotate around

  • cy – y value of the center point you want to rotate around

  • angle_degrees – Angle, in degrees, to rotate

Returns

Return rotated (x, y) pair

Return type

(float, float)