class HexaPDF::Content::GraphicObject::SolidArc

Parent

This graphic object represents a solid elliptical arc, i.e. an arc that has an inner and an outer set of a/b values.

This graphic object is registered under the :solid_arc key for use with the HexaPDF::Content::Canvas class.

Thus it can be used to create

  • an (elliptical) disk (when the inner a/b are zero and the difference between start and end angles is greater than or equal to 360),

    canvas.fill_color("red").
      draw(:solid_arc, outer_a: 80, outer_b: 50, end_angle: 360).
      fill_stroke
    

  • an (elliptical) sector (when the inner a/b are zero and the difference between start and end angles is less than 360),

    canvas.fill_color("red").
      draw(:solid_arc, outer_a: 80, outer_b: 50, start_angle: 20, end_angle: 230).
      fill_stroke
    

  • an (elliptical) annulus (when the inner a/b are nonzero and the difference between start and end angles is greater than or equal to 360), and

    canvas.fill_color("red").
      draw(:solid_arc, outer_a: 80, outer_b: 50, inner_a: 70, inner_b: 30,
           end_angle: 360).
      fill_stroke
    

  • an (elliptical) *annular sector* (when the inner a/b are nonzero and the difference between start and end angles is less than 360)

    canvas.fill_color("red").
      draw(:solid_arc, outer_a: 80, outer_b: 50, inner_a: 70, inner_b: 30,
           start_angle: 20, end_angle: 230).
      fill_stroke
    

See: Arc

Attributes

cx[R]

x-coordinate of center point

Examples:

solid_arc = canvas.graphic_object(:solid_arc, outer_a: 30, outer_b: 20,
                                  inner_a: 20, inner_b: 10)
canvas.draw(solid_arc).stroke
canvas.stroke_color("red").draw(solid_arc, cx: 50).stroke

cy[R]

y-coordinate of center point

Examples:

solid_arc = canvas.graphic_object(:solid_arc, outer_a: 30, outer_b: 20,
                                  inner_a: 20, inner_b: 10)
canvas.draw(solid_arc).stroke
canvas.stroke_color("red").draw(solid_arc, cy: 50).stroke

end_angle[R]

End angle of the solid arc in degrees

Examples:

solid_arc = canvas.graphic_object(:solid_arc, outer_a: 30, outer_b: 20,
                                  inner_a: 20, inner_b: 10)
canvas.draw(solid_arc).stroke
canvas.stroke_color("red").draw(solid_arc, end_angle: 120).stroke

inclination[R]

Inclination in degrees of semi-major axis in respect to x-axis

Examples:

solid_arc = canvas.graphic_object(:solid_arc, outer_a: 30, outer_b: 20,
                                  inner_a: 20, inner_b: 10)
canvas.draw(solid_arc).stroke
canvas.stroke_color("red").draw(solid_arc, inclination: 40).stroke

inner_a[R]

Length of inner semi-major axis which (without altering the inclination) is parallel to the x-axis

Examples:

solid_arc = canvas.graphic_object(:solid_arc, outer_a: 30, outer_b: 20,
                                  inner_a: 20, inner_b: 10)
canvas.draw(solid_arc).stroke
canvas.stroke_color("red").draw(solid_arc, inner_a: 5).stroke

inner_b[R]

Length of inner semi-minor axis which (without altering the inclination) is parallel to the y-axis

Examples:

solid_arc = canvas.graphic_object(:solid_arc, outer_a: 30, outer_b: 20,
                                  inner_a: 20, inner_b: 10)
canvas.draw(solid_arc).stroke
canvas.stroke_color("red").draw(solid_arc, inner_b: 20).stroke

outer_a[R]

Length of outer semi-major axis which (without altering the inclination) is parallel to the x-axis

Examples:

solid_arc = canvas.graphic_object(:solid_arc, outer_a: 30, outer_b: 20,
                                  inner_a: 20, inner_b: 10)
canvas.draw(solid_arc).stroke
canvas.stroke_color("red").draw(solid_arc, outer_a: 45).stroke

outer_b[R]

Length of outer semi-minor axis which (without altering the inclination) is parallel to the y-axis

Examples:

solid_arc = canvas.graphic_object(:solid_arc, outer_a: 30, outer_b: 20,
                                  inner_a: 20, inner_b: 10)
canvas.draw(solid_arc).stroke
canvas.stroke_color("red").draw(solid_arc, outer_b: 40).stroke

start_angle[R]

Start angle of the solid arc in degrees

Examples:

solid_arc = canvas.graphic_object(:solid_arc, outer_a: 30, outer_b: 20,
                                  inner_a: 20, inner_b: 10)
canvas.draw(solid_arc).stroke
canvas.stroke_color("red").draw(solid_arc, start_angle: 60).stroke

Public Class Methods

configure(**kwargs)

Creates and configures a new solid arc object.

See configure for the allowed keyword arguments.

new()

Creates a solid arc with default values (a unit disk at the origin).

Public Instance Methods

configure(cx: nil, cy: nil, inner_a: nil, inner_b: nil, outer_a: nil, outer_b: nil, start_angle: nil, end_angle: nil, inclination: nil)

Configures the solid arc with

  • center point (cx, cy),

  • inner semi-major axis inner_a,

  • inner semi-minor axis inner_b,

  • outer semi-major axis outer_a,

  • outer semi-minor axis outer_b,

  • start angle of start_angle degrees,

  • end angle of end_angle degrees and

  • an inclination in respect to the x-axis of inclination degrees.

Any arguments not specified are not modified and retain their old value, see initialize for the inital values.

Returns self.

draw(canvas)

Draws the solid arc on the given Canvas.