Murl Engine Lua Addon API  Version 1.0 beta
Murl.Math.Sphere

A sphere class.


Table members

Functions


Murl.Math.Sphere.new()

The default constructor.

Murl.Math.Sphere new()

Returns
Murl.Math.Sphere

Murl.Math.Sphere.new(centerX, centerY, centerZ, radius)

Constructor taking individual center position coordinates and a radius.

Murl.Math.Sphere new(Number centerX, Number centerY, Number centerZ, Number radius)

Parameters
centerXThe center x-position coordinate.
centerYThe center y-position coordinate.
centerZThe center z-position coordinate.
radiusThe radius.
Returns
Murl.Math.Sphere

Murl.Math.Sphere.new(box)

Constructor taking a box.

Murl.Math.Sphere new(Murl.Math.Box box)

Parameters
boxThe box to fit in.
Returns
Murl.Math.Sphere

Murl.Math.Sphere.new(s1, s2)

Constructor uniting two given spheres.

Murl.Math.Sphere new(Murl.Math.Sphere s1, Murl.Math.Sphere s2)

Parameters
s1The first sphere to unite.
s2The second sphere to unite.
Returns
Murl.Math.Sphere

Murl.Math.Sphere.new(center, radius)

Constructor taking a center position vector and a radius.

Murl.Math.Sphere new(Murl.Math.Vector center, Number radius)

Parameters
centerThe center position.
radiusThe radius.
Returns
Murl.Math.Sphere

Murl.Math.Sphere.new(a, b, c)

Constructor taking the three points of a triangle.

Murl.Math.Sphere new(Murl.Math.Vector a, Murl.Math.Vector b, Murl.Math.Vector c)

Parameters
aThe first triangle point.
bThe second triangle point.
cThe third triangle point.
Returns
Murl.Math.Sphere


Methods


Clear()

Clear the sphere

Clear()


Set(box)

Set the sphere to fit into a box.

Set(Murl.Math.Box box)

Parameters
boxThe box to fit in.

Set(other)

Copy the content of a source sphere to the sphere instance.

Set(Murl.Math.Sphere other)

Parameters
otherThe sphere to copy from.

Set(s1, s2)

Unite two spheres to the sphere instance.

Set(Murl.Math.Sphere s1, Murl.Math.Sphere s2)

Parameters
s1The first sphere to unite.
s2The second sphere to unite.

Set(center, radius)

Set a center position vector and a radius.

Set(Murl.Math.Vector center, Number radius)

Parameters
centerThe center position.
radiusThe radius.

SetBounding(a)

Set the sphere containing a single point. The center of the sphere is set to the given point, and the radius to 0.

SetBounding(Murl.Math.Vector a)

Parameters
aThe point.

SetBounding(a, b)

Set the sphere containing two points. The center of the sphere is set to the position at half way between the given points, and the radius to half their distance.

SetBounding(Murl.Math.Vector a, Murl.Math.Vector b)

Parameters
aThe first point.
bThe second point.

SetBounding(a, b, c)

Set the sphere using three points lying on the sphere boundary.

SetBounding(Murl.Math.Vector a, Murl.Math.Vector b, Murl.Math.Vector c)

Parameters
aThe first point.
bThe second point.
cThe third point.

SetBounding(a, b, c, d)

Set the sphere using four points lying on the sphere boundary.

SetBounding(Murl.Math.Vector a, Murl.Math.Vector b, Murl.Math.Vector c, Murl.Math.Vector d)

Parameters
aThe first point.
bThe second point.
cThe third point.
dThe fourth point.

SetContaining(a)

Set the sphere containing a single point.

SetContaining(Murl.Math.Vector a)

Parameters
aThe point.

SetContaining(a, b)

Set the sphere containing two points. This is equal to setting the sphere with the given two points lying on the surface of the returned sphere.

SetContaining(Murl.Math.Vector a, Murl.Math.Vector b)

Parameters
aThe first point.
bThe second point.

SetContaining(a, b, c)

Set the sphere containing three points. This is different to SetBounding() in that one of the given points may lie inside the returned sphere and not on the boundary.

SetContaining(Murl.Math.Vector a, Murl.Math.Vector b, Murl.Math.Vector c)

Parameters
aThe first point.
bThe second point.
cThe third point.

SetCenter(center)

Set the center position.

SetCenter(Murl.Math.Vector center)

Parameters
centerThe center position.

GetCenter()

Get the center position.

Murl.Math.Vector GetCenter()

Returns
Murl.Math.Vector The center position.

SetRadius(radius)

Set the radius.

SetRadius(Number radius)

Parameters
radiusThe radius.

GetRadius()

Get the radius.

Number GetRadius()

Returns
Number The radius.

Unite(other)

Unite this sphere with another sphere.

Unite(Murl.Math.Sphere other)

Parameters
otherThe other sphere to unite.

Include(point)

Include a point in this sphere.

Include(Murl.Math.Vector point)

Parameters
pointThe point to include.

IsIntersecting(other)

Check if a given sphere is intersecting this sphere.

Boolean IsIntersecting(Murl.Math.Sphere other)

Parameters
otherThe other sphere to check.
Returns
Boolean true if the other sphere is intersecting this sphere.

IsContaining(p)

Check if a given point is inside this sphere.

Boolean IsContaining(Murl.Math.Vector p)

Parameters
pThe point to check.
Returns
Boolean true if the point is inside this sphere.

IsEmpty()

Check if a the sphere is empty. A sphere is only empty when created with the default constructor, explicitly cleared by calling Clear(), or duplicated from another empty sphere or box. As soon as a single point is included, the sphere is considered "not empty".

Boolean IsEmpty()

Returns
Boolean true if the box is empty.

GetFlags()

Get the flags.

Integer GetFlags()

Returns
Integer The bit-mask of flags.

ToString()

Get the string representation of the object.

String ToString()

Returns
String The string representation of the object.


Metamethods


The tostring operator

Converts the object content to a string in a reasonable format.

Returns
ToString()