CP::BB
Inherits Struct / Value / Object
Chipmunk's axis-aligned 2D bounding box type. (left, bottom, right, top)
Constructors
new(left : Number = 0, bottom : Number = 0, right : Number = 0, top : Number = 0)
Sourcenew_for_circle(p : Vect, r : Number) : self
Constructs a BB fitting a circle with the position p and radius r.
new_for_extents(c : Vect, hw : Number, hh : Number) : self
Constructs a BB centered on a point with the given extents (half sizes).
Instance methods
bottom
Sourcebottom=(bottom : Float64)
Sourceexpand(point : Vect) : BB
Returns the minimal bounding box that contains both this BB and the point.
intersects_segment?(a : Vect, b : Vect) : Bool
Return true if the bounding box intersects the line segment with ends a and b.
left
Sourceleft=(left : Float64)
Sourceright
Sourceright=(right : Float64)
Sourcesegment_query(a : Vect, b : Vect) : Float64
Returns the fraction along the segment query the BB is hit.
Returns INFINITY if it doesn't hit.
top
Sourcetop=(top : Float64)
Source