class CP::Shape::Circle
- CP::Shape::Circle
- CP::Shape
- Reference
- Object
Overview
A circle shape defined by a radius
This is the fastest and simplest collision shape
Defined in:
chipmunk/shape.crchipmunk/unsafe.cr
Constructors
-
.new(body : Body | Nil, radius : Number, offset : Vect = CP::Vect.new(0, 0))
The parameters are: the body to attach the circle to; the offset from the body's center of gravity in body local coordinates.
Class Method Summary
-
.area(r1 : Number, r2 : Number) : Float64
Calculate area of a hollow circle.
-
.moment(m : Number, r1 : Number, r2 : Number, offset : Vect = CP::Vect.new(0, 0)) : Float64
Calculate the moment of inertia for a circle.
Instance Method Summary
-
#offset : Vect
Get the offset of a circle shape.
-
#offset=(offset : Vect)
Unsafe. Set the offset of a circle shape.
-
#radius : Float64
Get the radius of a circle shape.
-
#radius=(radius : Number)
Unsafe. Set the radius of a circle shape.
Instance methods inherited from class CP::Shape
area : Float64
area,
bb : BB
bb,
body : Body | Nil
body,
body=(body : Body | Nil)
body=,
cache_bb : BB
cache_bb,
center_of_gravity : Vect
center_of_gravity,
collide(b : Shape) : ContactPointSet
collide,
collision_type : CollisionType
collision_type,
collision_type=(collision_type : Int)
collision_type=,
density : Float64
density,
density=(density : Number)
density=,
elasticity : Float64
elasticity,
elasticity=(elasticity : Number)
elasticity=,
filter : ShapeFilter
filter,
filter=(filter : ShapeFilter)
filter=,
friction : Float64
friction,
friction=(friction : Number)
friction=,
mass : Float64
mass,
mass=(mass : Number)
mass=,
moment : Float64
moment,
point_query(p : Vect) : PointQueryInfo
point_query,
segment_query(a : Vect, b : Vect, radius : Number = 0) : SegmentQueryInfo | Nil
segment_query,
sensor=(sensor : Bool)
sensor=,
sensor? : Bool
sensor?,
space : Space | Nil
space,
surface_velocity : Vect
surface_velocity,
surface_velocity=(surface_velocity : Vect)
surface_velocity=,
update(transform : Transform) : BB
update
Constructor Detail
The parameters are: the body to attach the circle to; the offset from the body's center of gravity in body local coordinates.
Class Method Detail
Calculate area of a hollow circle.
r1 and r2 are the inner and outer diameters. A solid circle has an inner diameter of 0.
Calculate the moment of inertia for a circle.
r1 and r2 are the inner and outer diameters. A solid circle has an inner diameter of 0.
Instance Method Detail
Unsafe. Set the offset of a circle shape.
This change is only picked up as a change to the position of the shape's surface, but not its velocity. Changing it will not result in realistic physical behavior. Only use if you know what you are doing!
Unsafe. Set the radius of a circle shape.
This change is only picked up as a change to the position of the shape's surface, but not its velocity. Changing it will not result in realistic physical behavior. Only use if you know what you are doing!