Unit Breakout.Physics
Description
Continuous circle sweeps and velocity response in logical coordinates.
Source: src/Breakout.Physics.pas (line 2).
Overview
Classes, Interfaces, Objects and Records
| Name | Description |
|---|---|
Record TPhysicsRect |
Axis-aligned bounds; screen Y grows downward. |
Record TCircleHit |
Earliest contact: Time in seconds, outward unit normal and initial overlap depth in logical units. |
Functions and Procedures
function SweepCircleRect(CX, CY, Radius, VX, VY, MaxTime: Double; const Rect: TPhysicsRect; out Hit: TCircleHit): Boolean; |
function SweepCirclePaddle(CX, CY, Radius, VX, VY, MaxTime: Double; const Rect: TPhysicsRect; out Hit: TCircleHit): Boolean; |
procedure ReflectVelocity(var VX, VY: Double; NX, NY: Double); |
procedure PaddleVelocity(Offset, Speed, IncomingVX, MinAngle, MaxAngle: Double; out VX, VY: Double); |
Constants
PositionEpsilon = 1.0E-6; |
TimeEpsilon = 1.0E-10; |
Description
Functions and Procedures
function SweepCircleRect(CX, CY, Radius, VX, VY, MaxTime: Double; const Rect: TPhysicsRect; out Hit: TCircleHit): Boolean; |
|
Sweeps a circle against a rectangle over [0, MaxTime]. Tests four face segments and four circular corner arcs, including initial overlap. Parameters
ReturnsTrue when contact is found in the interval. Source: src/Breakout.Physics.pas (line 36). |
function SweepCirclePaddle(CX, CY, Radius, VX, VY, MaxTime: Double; const Rect: TPhysicsRect; out Hit: TCircleHit): Boolean; |
|
Sweeps against a horizontal capsule with cap radius half its height. Reduces to the center segment dilated by ball radius plus cap radius. Coordinates, velocity, time and Hit follow SweepCircleRect. Source: src/Breakout.Physics.pas (line 41). |
procedure ReflectVelocity(var VX, VY: Double; NX, NY: Double); |
|
Applies v := v - 2*dot(v,n)*n only when approaching the surface. NX/NY must form an outward unit normal; separating velocity is unchanged. Source: src/Breakout.Physics.pas (line 45). |
procedure PaddleVelocity(Offset, Speed, IncomingVX, MinAngle, MaxAngle: Double; out VX, VY: Double); |
|
Maps normalized horizontal impact offset to an upward velocity. Parameters
Source: src/Breakout.Physics.pas (line 54). |
Constants
PositionEpsilon = 1.0E-6; |
|
Spatial tolerance and post-contact separation in logical units. Source: src/Breakout.Physics.pas (line 21). |
TimeEpsilon = 1.0E-10; |
|
Temporal tolerance for contact times in seconds. Source: src/Breakout.Physics.pas (line 23). |
Generated by PasDoc 1.0.4.