Hide menu
Loading...
Searching...
No Matches
Cylinder

Defines a 3D cylinder.

A cylinder is defined by its axis, radius, and height. The axis location is the center of the cylinder.

Constructors

Constructor

new Cylinder(axis?, radius?, height?): Cylinder

Creates a cylinder from an axis, radius, and height.

The provided axis is copied, so later changes to the original object do not affect this cylinder. If radius or height is omitted, the corresponding value remains 0. Negative radius and height values are clamped to 0.

Parameters

axis?

Axis1d

Axis of the cylinder.

radius?

number

Outer radius of the cylinder.

height?

number

Height of the cylinder along the axis.

Returns

Cylinder

Accessors

axis

Get Signature

get axis(): Axis1d

Axis of the cylinder.

Assigning a new axis copies its values without replacing the existing object returned by this property.

Returns

Axis1d

Set Signature

set axis(axis): void

Sets the axis of the cylinder.

The values of axis are copied without replacing the existing axis object.

Parameters

axis

Axis1d

Axis of the cylinder.

Returns

void


center

Get Signature

get center(): Point

Copy of the cylinder center point.

Returns

Point


height

Get Signature

get height(): number

Height of the cylinder along its axis.

Negative values are stored as 0.

Returns

number

Set Signature

set height(height): void

Sets the height of the cylinder along its axis.

Negative values are stored as 0.

Parameters

height

number

Height of the cylinder along the axis.

Returns

void


radius

Get Signature

get radius(): number

Outer radius of the cylinder.

Negative values are stored as 0.

Returns

number

Set Signature

set radius(radius): void

Sets the outer radius of the cylinder.

Negative values are stored as 0.

Parameters

radius

number

Outer radius of the cylinder.

Returns

void


surfaceArea

Get Signature

get surfaceArea(): number

Surface area of the cylinder.

Returns

number


volume

Get Signature

get volume(): number

Volume of the cylinder.

Returns

number

Methods

clone()

clone(): Cylinder

Creates a new cylinder with the same axis, radius, and height as this cylinder.

Returns

Cylinder


copy()

copy(other): this

Copies the axis, radius, and height of other to this cylinder.

The axis values are copied without replacing the existing axis object.

Parameters

other

Cylinder

Cylinder to copy.

Returns

this


isContaining()

isContaining(point): boolean

Returns true if the point lies inside the cylinder or on its boundary.

Parameters

point

Point

Checked point.

Returns

boolean


isInfinity()

isInfinity(): boolean

Returns true if the cylinder has an unbounded radius or height.

This includes non-finite values and Number.MAX_VALUE.

Returns

boolean


multiplied()

multiplied(scalar): Cylinder

Returns a new cylinder obtained by applying multiply() to this cylinder.

Parameters

scalar

number

Scalar value.

Returns

Cylinder


multiply()

multiply(scalar): this

Scales the cylinder by a scalar value.

The radius and height are multiplied by Math.abs(scalar) so they remain non-negative. The axis is not changed.

Parameters

scalar

number

Scalar value.

Returns

this


setAxis()

setAxis(axis): this

Sets the cylinder axis.

The values of axis are copied without replacing the existing axis object.

Parameters

axis

Axis1d

Axis of the cylinder.

Returns

this


setHeight()

setHeight(height): this

Sets the cylinder height.

Negative values are stored as 0.

Parameters

height

number

Height of the cylinder along the axis.

Returns

this


setRadius()

setRadius(radius): this

Sets the cylinder radius.

Negative values are stored as 0.

Parameters

radius

number

Outer radius of the cylinder.

Returns

this


transform()

transform(transformation): this

Transforms the cylinder.

The axis is transformed by transformation. The radius and height are scaled by the absolute value of the transformation scale factor.

Parameters

transformation

Transformation

Transformation.

Returns

this


transformed()

transformed(transformation): Cylinder

Returns a new cylinder obtained by applying transform() to this cylinder.

Parameters

transformation

Transformation

Transformation.

Returns

Cylinder