struct Geode::Circle

Overview

The Circle struct represents a circle.

Defined in:

geode/circle.cr

Constructors

Instance Method Summary

Constructor Detail

def self.new(radius : Number::Primitive = 1, center : Point = Point.new) #

Creates a new Circle. Note that the radius must be positive.


[View source]

Instance Method Detail

def ==(other : self) #

def arc_length(angle : Angle) #

Returns the length along the circle's circumference of the arc defined by the given angle.


[View source]
def area #

Returns the area of the circle.


[View source]
def center : Geode::Point #

Returns the center of the circle.


[View source]
def circumference #

Returns the circumference of the circle.


[View source]
def contains?(other : Point) #

Returns whether the given point lies on or inside the circle's circumference.


[View source]
def hash(hasher) #
Description copied from struct Struct

See Object#hash(hasher)


def include?(other : Point) #

Returns whether the given point lies on the circumference of the circle.


[View source]
def radius : Float32 | Float64 | Int128 | Int16 | Int32 | Int64 | Int8 | UInt128 | UInt16 | UInt32 | UInt64 | UInt8 #

Returns the radius of the circle.


[View source]
def sector_area(angle : Angle) #

Returns the area of the sector of the circle defined by the given angle.


[View source]
def to_point(angle : Angle) #

Returns the Point along the circle's circumference that corresponds to the given angle.


[View source]
def to_s(io : IO) #

Returns a string representation of the circle in the form (x-h)^2 + (y-k)^2 = r, where (h, k) is the circle's circumference and r is the circle's radius squared.


[View source]