struct
CP::BB
- CP::BB
- Struct
- Value
- Object
Overview
Chipmunk's axis-aligned 2D bounding box type. (left, bottom, right, top)
Defined in:
chipmunk/vector.crConstructors
- .new(left : Number = 0, bottom : Number = 0, right : Number = 0, top : Number = 0)
-
.new_for_circle(p : Vect, r : Number) : self
Constructs a
BBfitting a circle with the position p and radius r. -
.new_for_extents(c : Vect, hw : Number, hh : Number) : self
Constructs a
BBcentered on a point with the given extents (half sizes).
Instance Method Summary
-
#area : Float64
Returns the area of the bounding box.
- #bottom : Float64
- #bottom=(bottom : Float64)
-
#center : Vect
Returns the center of a bounding box.
-
#clamp_vect(v : Vect) : Vect
Clamp a vector to a bounding box
-
#contains?(other : BB) : Bool
Returns true if the other
BBlies completely within this one. -
#contains?(point : Vect) : Bool
Returns true if this
BBcontains the point. -
#expand(point : Vect) : BB
Returns the minimal bounding box that contains both this
BBand the point. -
#intersects?(other : BB) : Bool
Returns true if this
BBintersects the other. -
#intersects_segment?(a : Vect, b : Vect) : Bool
Return true if the bounding box intersects the line segment with ends a and b.
- #left : Float64
- #left=(left : Float64)
-
#merge(other : BB) : BB
Returns a bounding box that holds both bounding boxes.
-
#offset(v : Vect) : BB
Returns a bounding box offseted by v.
- #right : Float64
- #right=(right : Float64)
-
#segment_query(a : Vect, b : Vect) : Float64
Returns the fraction along the segment query the
BBis hit. - #top : Float64
- #top=(top : Float64)
-
#wrap_vect(v : Vect) : Vect
Wrap a vector to a bounding box.
Constructor Detail
Constructs a BB fitting a circle with the position p and radius r.
Constructs a BB centered on a point with the given extents (half sizes).
Instance Method Detail
Returns true if the other BB lies completely within this one.
Returns the minimal bounding box that contains both this BB and the point.
Return true if the bounding box intersects the line segment with ends a and b.
Returns the fraction along the segment query the BB is hit.
Returns INFINITY if it doesn't hit.