vivid v0.2.1 Vivid.Arc
This module represents an Arc, otherwise known as a circle segment.
Summary
Functions
Returns the center point of an Arc
Changes the center point of an Arc
Creates an Arc
Returns the radius of an Arc
Change the radius of an Arc
Returns the range of the Arc
Change the range of an Arc
Returns the start angle of an Arc
Change the start angle of an Arc
Returns the number of steps in the Arc
Changes the number of steps in an Arc
Converts the Arc into a Path, which is used for a bunch of things like Transforms, Bounds calculation, Rasterization, etc
Types
Functions
Returns the center point of an Arc
Example
iex> Vivid.Arc.init(Vivid.Point.init(10,10), 5, 0, 90, 12)
...> |> Vivid.Arc.center
#Vivid.Point<{10, 10}>
Changes the center point of an Arc
Example
iex> Vivid.Arc.init(Vivid.Point.init(10,10), 5, 0, 90, 12)
...> |> Vivid.Arc.center(Vivid.Point.init(15,15))
...> |> Vivid.Arc.center
#Vivid.Point<{15, 15}>
init(Vivid.Point.t, number, number, number, integer) :: Vivid.Arc.t
Creates an Arc.
center
is a Point definining the center point of the arc’s parent circle.
radius
is the radius of the parent circle.
start_angle
is the angle at which to start drawing the arc, 0
is vertical.
range
is the number of degrees to draw the arc.
steps
the arc is drawn by dividing it into a number of lines. Defaults to 12.
iex> Vivid.Arc.init(Vivid.Point.init(5,5), 4, 45, 15)
%Vivid.Arc{
center: %Vivid.Point{x: 5, y: 5},
radius: 4,
start_angle: 45,
range: 15,
steps: 12
}
Returns the radius of an Arc
Example
iex> Vivid.Arc.init(Vivid.Point.init(10,10), 5, 0, 90, 12)
...> |> Vivid.Arc.radius
5
Change the radius of an Arc
Example
iex> Vivid.Arc.init(Vivid.Point.init(10,10), 5, 0, 90, 12)
...> |> Vivid.Arc.radius(10)
...> |> Vivid.Arc.radius
10
Returns the range of the Arc
Example
iex> Vivid.Arc.init(Vivid.Point.init(10,10), 5, 0, 90, 12)
...> |> Vivid.Arc.range
90
Change the range of an Arc
Example
iex> Vivid.Arc.init(Vivid.Point.init(10,10), 5, 0, 90, 12)
...> |> Vivid.Arc.range(270)
...> |> Vivid.Arc.range
270
Returns the start angle of an Arc
Example
iex> Vivid.Arc.init(Vivid.Point.init(10,10), 5, 0, 90, 12)
...> |> Vivid.Arc.start_angle
0
Change the start angle of an Arc
Example
iex> Vivid.Arc.init(Vivid.Point.init(10,10), 5, 0, 90, 12)
...> |> Vivid.Arc.start_angle(45)
...> |> Vivid.Arc.start_angle
45
Returns the number of steps in the Arc
Example
iex> Vivid.Arc.init(Vivid.Point.init(10,10), 5, 0, 90, 12)
...> |> Vivid.Arc.steps
12
Changes the number of steps in an Arc
Example
iex> Vivid.Arc.init(Vivid.Point.init(10,10), 5, 0, 90, 12)
...> |> Vivid.Arc.steps(19)
...> |> Vivid.Arc.steps
19
Converts the Arc into a Path, which is used for a bunch of things like Transforms, Bounds calculation, Rasterization, etc.
Example
iex> Vivid.Arc.init(Vivid.Point.init(10,10), 5, 0, 90, 3)
...> |> Vivid.Arc.to_path
#Vivid.Path<[#Vivid.Point<{5, 10}>, #Vivid.Point<{6, 13}>, #Vivid.Point<{8, 14}>, #Vivid.Point<{10, 15}>]>