The radius of the circle. The circle will be located at Point.origin and aligned to Vector.xAxis.
The radius of the circle. The circle will be located at Point.origin and aligned to Vector.xAxis.
The center of the circle. The circle will be aligned to Vector.xAxis.
The radius of the circle. The circle will be located at Point.origin and aligned to Vector.xAxis.
The center of the circle. The circle will be aligned to Vector.xAxis.
Gets the area of the circle.
Gets the smallest bounding box that contains the circle.
Gets the center of the circle.
Gets the circumference of the circle.
Gets the diameter of the circle.
Gets the plane defining the circle's position. The plane's origin is the center of the circle. The plane's x-axis is the orientation of the circle.
Gets the radius of the circle.
Finds the closest point on the circle and returns the point.
Target to get closest to.
If false, the closest point must lie on the outer edge of the circle. If true, the closest point can also be a point on the interior of the circle.
Checks whether a point is inside, outside, or on the edge of a circle.
The point to test for containment.
The distance the point can be from the edge of the circle and still considered coincident.
The circle to compare against.
The amount the radius and plane can differ and still be considered equal.
Finds the point a certain number of radians from the start. Returns the point.
Position of the point (in radians). This is measured counter-clockwise from the start of the circle.
Finds the point a certain distance from the start. Returns the point.
Position of the point. This is measured counter-clockwise from the start of the circle.
Finds the tangent for the circle a certain number of radians from the start.
Position of the tangent (in radians). This is measured counter-clockwise from the start of the circle.
Gets the circle as a string in the format: [plane,radius]
.
Creates a copy of the circle with a different circumference. The circle will be in the same position but have a different radius.
The circumference of the new circle.
Translates the geometry from one coordinate system to another while keeping
the geometry in the same position. In other words, if the geometry is currently
described relative to planeFrom
, after changeBasis,
it will be in the same position but described relative to planeTo
.
The coordinate system the geometry is currently described relative to.
The coordinate system to describe the geometry relative to.
The geometry in the new coordinate system.
Rotates the geometry about (0,0).
Angle to rotate the geometry (in radians). The direction is counter-clockwise.
Rotates the geometry about a point.
Angle to rotate the geometry (in radians). If the environment's y-axis points upwards, the direction is counter-clockwise.
Point to pivot the geometry about.
Scales the geometry and returns the resized geometry. The geometry will be scaled about (0,0), meaning everything will shrink or expand away from this point.
Magnitude to scale in x- and y-direction. If less than 1, the object will shrink. If greater than 1, it will grow.
Scales the geometry and returns the resized geometry. The geometry will be scaled about (0,0), meaning everything will shrink or expand away from this point.
Magnitude to scale in x-direction. If less than 1, the object will shrink. If greater than 1, it will grow.
Magnitude to scale in y-direction. If less than 1, the object will shrink. If greater than 1, it will grow.
Scales the geometry about a point and returns the resized geometry.
Magnitude to scale in x-direction. If less than 1, the object will shrink. If greater than 1, it will grow.
Magnitude to scale in y-direction. If less than 1, the object will shrink. If greater than 1, it will grow.
Center of scaling. Everything will shrink or expand away from this point.
Transforms the circle by a transform matrix and returns the result.
import { Circle, Transform } from 'shapetypes';
// Create circle
const circle = new Circle(10);
console.log(circle.radius);
// => 10
// Scale using a transform matrix
const matrix = Transform.scale(2);
const scaled = scale.transform(matrix);
console.log(scaled.radius);
// => 20
// Scale using the direct method
const otherScaled = circle.scale(2);
console.log(otherScaled.radius);
// => 20
Moves the geometry along a vector and returns the moved geometry. The translation is always linear.
The direction and distance to move the geometry.
Moves the geometry along a vector and returns the moved geometry. The translation is always linear.
The direction to move the geometry.
The distance to move the geometry.
Generated using TypeDoc
A circle is defined by a center point and a radius. A circle also has an orientation (defined by a plane). The orientation is important as it controls where the circle's outer edge starts/ends, which is used in methods like pointAt, to generate points on the circle's edge.
Example
import { Circle, Point } from 'shapetypes'; // Create a new circle const circle = new Circle(10, new Point(3,4)); // Get properties of the circle console.log(circle.center.toString()); // => (3,4) console.log(circle.area); // => 314.16 // Scale the circle const larger = circle.scale(2); console.log(larger.radius); // => 20