Cone class

A class representing a cone in 3D space.

A cone is a solid that has a circular base and a single vertex. This implementation assumes a right circular cone.

Properties:

  • Radius (of the base)
  • Height
  • Slant Height = √(r² + h²)
  • Volume = (1/3) × π × r² × h
  • Surface Area = πr(r + s)

Example:

var cone = Cone(radius: 3.0, height: 4.0);
print('Slant Height: ${cone.slantHeight}'); // 5.0
print('Volume: ${cone.volume()}');
Inheritance

Constructors

Cone({required double radius, required double height, Point? center})
Creates a cone with specified radius and height.

Properties

center Point
The center point of the base of the cone.
getter/setter pair
hashCode int
The hash code for this object.
no setterinherited
height double
The height of the cone.
getter/setter pair
name String
The name of the geometric shape.
getter/setter pairinherited
radius double
The radius of the base.
getter/setter pair
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
slantHeight double
Gets the slant height of the cone.
no setter

Methods

area() double
Calculates the area of the geometric shape.
override
boundingBox() BoundingBox3D
Calculates the axis-aligned bounding box (AABB) of the 3D shape.
override
lateralSurfaceArea() double
Calculates the lateral surface area (side area only).
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
perimeter() double
Calculates the perimeter of the 3D geometric shape.
inherited
surfaceArea() double
Calculates the total surface area of the cone.
override
toString() String
A string representation of this object.
override
volume() double
Calculates the volume of the cone.
override

Operators

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