class CP::Shape::Circle

Overview

A circle shape defined by a radius

This is the fastest and simplest collision shape

Defined in:

chipmunk/shape.cr
chipmunk/unsafe.cr

Constructors

Class Method Summary

Instance Method Summary

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

def self.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.


[View source]

Class Method Detail

def self.area(r1 : Number, r2 : Number) : Float64 #

Calculate area of a hollow circle.

r1 and r2 are the inner and outer diameters. A solid circle has an inner diameter of 0.


[View source]
def self.moment(m : Number, r1 : Number, r2 : Number, offset : Vect = CP::Vect.new(0, 0)) : Float64 #

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.


[View source]

Instance Method Detail

def offset : Vect #

Get the offset of a circle shape.


[View source]
def offset=(offset : Vect) #

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!


[View source]
def radius : Float64 #

Get the radius of a circle shape.


[View source]
def radius=(radius : Number) #

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!


[View source]