CLASS v1.8.0

Capsule

pykraken.Capsule

Represents a capsule shape with two points and a radius.

Reference

PYTHON API

Constructor

method3 overloads
Capsule()
Capsule(p1: Vec2, p2: Vec2, radius: float)
Capsule(x1: float, y1: float, x2: float, y2: float, radius: float)

Overloaded function.

  1. Capsule()

Create a capsule with default values.

  1. Capsule(p1: Vec2, p2: Vec2, radius: float)

Create a capsule from two points and a radius.

Args

  • p1 (Vec2) — The first point.
  • p2 (Vec2) — The second point.
  • radius (float) — The radius of the capsule.
  1. Capsule(x1: float, y1: float, x2: float, y2: float, radius: float)

Create a capsule from coordinates and a radius.

Args

  • x1 (float) — The x coordinate of the first point.
  • y1 (float) — The y coordinate of the first point.
  • x2 (float) — The x coordinate of the second point.
  • y2 (float) — The y coordinate of the second point.
  • radius (float) — The radius of the capsule.

p1

property
p1: Vec2

The first point.

p2

property
p2: Vec2

The second point.

radius

property
radius: float

The radius.

as_rect

method
as_rect(self) -> Rect

Get the axis-aligned bounding box of the capsule.

Returns

  • Rect — The bounding box.

copy

method
copy(self) -> Capsule

Create a copy of the capsule.

Returns

  • Capsule — The copy.

Find your next step

Start typing to search the manual.