Sector class

A class representing a circular sector (pie slice) in 2D space.

A sector is a region of a circle bounded by two radii and an arc.

Properties:

  • Radius
  • Central angle
  • Area = (θ/2) × r²
  • Arc length = θ × r
  • Perimeter = 2r + arc length

Example:

var sector = Sector.from(radius: 5.0, centralAngle: Angle(deg: 60));
print('Area: ${sector.area()}'); // Area of sector
print('Arc Length: ${sector.arcLength}');
Inheritance

Constructors

Sector(num radius, Angle centralAngle, {Point? center})
Creates a sector with the specified radius and central angle.
Sector.from({required num radius, required Angle centralAngle, Point? center})
Named constructor following existing pattern.
factory
Sector.fromArcLength(num radius, num arcLength, {Point? center})
Creates a sector from radius and arc length.
Sector.fromArea(num radius, num area, {Point? center})
Creates a sector from radius and area.

Properties

arcLength num
Gets the arc length of the sector.
no setter
center Point
getter/setter pair
centralAngle Angle
getter/setter pair
chordLength num
Gets the chord length (straight line connecting the arc endpoints).
no setter
hashCode int
The hash code for this object.
no setterinherited
height num
Gets the height (sagitta) of the arc.
no setter
name String
The name of the geometric shape.
getter/setter pairinherited
radius num
The radius of the circle from which the sector is taken
getter/setter pair
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

area() num
Calculates the area of the sector.
override
boundingBox() List<Point>
Calculates the bounding box of the sector.
contains(Point point) bool
Checks if a point is inside the sector.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
perimeter() num
Calculates the perimeter of the sector.
override
toString() String
A string representation of this object.
override

Operators

operator ==(Object other) bool
The equality operator.
inherited