Sphere

@Serializable
data class Sphere(val center: Vector3, val radius: Double) : LinearType<Sphere> , Movable3D, GeometricPrimitive3D(source)

Represents a 3D sphere defined by a center position and radius.

This class supports basic arithmetic operations, such as addition, subtraction, scaling, and division, as well as position manipulation in 3D space. It can also check if a given point lies within the sphere.

Constructors

Link copied to clipboard
constructor(center: Vector3, radius: Double)

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard

The center of the sphere in 3D space, represented as a Vector3.

Link copied to clipboard

The radius of the sphere.

Link copied to clipboard

The surface area of the sphere.

Link copied to clipboard

The volume of the sphere.

Functions

Link copied to clipboard
operator fun contains(point: Vector3): Boolean

Checks if the specified point is contained within the sphere.

Link copied to clipboard
open operator override fun div(scale: Double): Sphere
Link copied to clipboard
open operator override fun minus(right: Sphere): Sphere
Link copied to clipboard
open override fun movedBy(offset: Vector3): Sphere

Creates a new shape with the same size but the current position offset by the given amount.

Link copied to clipboard
open override fun movedTo(position: Vector3): Sphere

Creates a new shape with the same size but the current position is set to position.

Link copied to clipboard
open operator override fun plus(right: Sphere): Sphere
Link copied to clipboard
open operator override fun times(scale: Double): Sphere