Notes="Calculates the intersection of a ray (half-line), given by two of its points, with the bounding box. Returns false if the line doesn't intersect the bounding box, or true, together with coefficient of the intersection (how much of the difference between the two ray points is needed to reach the intersection), and the face of the box which is intersected.",
},
{
IsStatic=true,
Params=
{
{
Name="BoxMin",
Type="number",
},
{
Name="BoxMax",
Type="number",
},
{
Name="LineStart",
Type="Vector3d",
},
{
Name="LinePt2",
Type="Vector3d",
},
},
Returns=
{
{
Name="DoesIntersect",
Type="boolean",
},
{
Name="LineCoeff",
Type="number",
IsOptional=true,
},
{
Name="Face",
Type="eBlockFace",
IsOptional=true,
},
},
Notes="Calculates the intersection of a ray (half-line), given by two of its points, with the bounding box specified as its minimum and maximum coords. Returns false if the line doesn't intersect the bounding box, or true, together with coefficient of the intersection (how much of the difference between the two ray points is needed to reach the intersection), and the face of the box which is intersected.",
Notes="Creates a new bounding box with the specified edges",
},
{
Params=
{
{
Name="Min",
Type="number",
},
{
Name="Max",
Type="number",
},
},
Returns=
{
{
Type="cBoundingBox",
},
},
Notes="Creates a new bounding box with the coords specified as two vectors",
},
{
Params=
{
{
Name="Pos",
Type="Vector3d",
},
{
Name="Radius",
Type="number",
},
{
Name="Height",
Type="number",
},
},
Returns=
{
{
Type="cBoundingBox",
},
},
Notes="Creates a new bounding box from the position given and radius (X/Z) and height. Radius is added from X/Z to calculate the maximum coords and subtracted from X/Z to get the minimum; minimum Y is set to Pos.y and maxumim Y to Pos.y plus Height. This corresponds with how {{cEntity|entities}} are represented in Minecraft.",
},
{
Params=
{
{
Name="OtherBoundingBox",
Type="cBoundingBox",
},
},
Returns=
{
{
Type="cBoundingBox",
},
},
Notes="Creates a new copy of the given bounding box. Same result can be achieved by using a simple assignment.",
},
{
Params=
{
{
Name="Pos",
Type="Vector3d",
},
{
Name="CubeSideLength",
Type="number",
},
},
Returns=
{
{
Type="cBoundingBox",
},
},
Notes="Creates a new bounding box as a cube with the specified side length centered around the specified point.",
Notes="Returns the boundary point with the minimum coords",
},
GetMinX=
{
Returns=
{
{
Type="number",
},
},
Notes="Returns the minimum X coord of the bounding box",
},
GetMinY=
{
Returns=
{
{
Type="number",
},
},
Notes="Returns the minimum Y coord of the bounding box",
},
GetMinZ=
{
Returns=
{
{
Type="number",
},
},
Notes="Returns the minimum Z coord of the bounding box",
},
Intersect=
{
Params=
{
{
Name="OtherBbox",
Type="cBoundingBox",
},
},
Returns=
{
{
Type="boolean",
},
{
Name="Intersection",
Type="cBoundingBox",
IsOptional=true,
},
},
Notes="Checks if the intersection between this bounding box and another one is non-empty. Returns false if the intersection is empty, true and a new cBoundingBox representing the intersection of the two boxes.",
Notes="Moves the bounding box by the specified offset in each axis",
},
{
Params=
{
{
Name="Offset",
Type="Vector3d",
},
},
Notes="Moves the bounding box by the specified offset in each axis",
},
},
Union=
{
Params=
{
{
Name="OtherBoundingBox",
Type="cBoundingBox",
},
},
Returns=
{
{
Type="cBoundingBox",
},
},
Notes="Returns the smallest bounding box that contains both OtherBoundingBox and this bounding box. Note that unlike the strict geometrical meaning of \"union\", this operation actually returns a cBoundingBox.",
Notes="If needed, expands the cuboid to include the specified point. Doesn't shrink. Assumes sorted. ",
},
Expand=
{
Params=
{
{
Name="SubMinX",
Type="number",
},
{
Name="AddMaxX",
Type="number",
},
{
Name="SubMinY",
Type="number",
},
{
Name="AddMaxY",
Type="number",
},
{
Name="SubMinZ",
Type="number",
},
{
Name="AddMaxZ",
Type="number",
},
},
Notes="Expands the cuboid by the specified amount in each direction. Works on unsorted cuboids as well. NOTE: this function doesn't check for underflows.",
},
GetVolume=
{
Returns=
{
{
Type="number",
},
},
Notes="Returns the volume of the cuboid, in blocks. Note that the volume considers both coords inclusive. Works on unsorted cuboids, too.",
},
IsCompletelyInside=
{
Params=
{
{
Name="OuterCuboid",
Type="cCuboid",
},
},
Returns=
{
{
Type="boolean",
},
},
Notes="Returns true if this cuboid is completely inside (in all directions) in OuterCuboid. Assumes both sorted.",
Notes="Returns the dot product of this vector and the specified vector.",
},
Equals=
{
Params=
{
{
Name="AnotherVector",
Type="Vector3d",
},
},
Returns=
{
{
Type="boolean",
},
},
Notes="Returns true if this vector is exactly equal to the specified vector. Note that this is subject to (possibly imprecise) floating point math.",
},
EqualsEps=
{
Params=
{
{
Name="AnotherVector",
Type="Vector3d",
},
{
Name="Eps",
Type="number",
},
},
Returns=
{
{
Type="boolean",
},
},
Notes="Returns true if the differences between each corresponding coords of this vector and the one specified are less than the specified Eps.",
},
Floor=
{
Returns=
{
{
Type="Vector3i",
},
},
Notes="Returns a new {{Vector3i}} object with coords set to math.floor of this vector's coords.",
},
HasNonZeroLength=
{
Returns=
{
{
Type="boolean",
},
},
Notes="Returns true if the vector has at least one coord non-zero. Note that this is subject to (possibly imprecise) floating point math.",
},
Length=
{
Returns=
{
{
Type="number",
},
},
Notes="Returns the (euclidean) length of the vector.",
},
LineCoeffToXYPlane=
{
Params=
{
{
Name="Vector3d",
Type="Vector3d",
},
{
Name="Z",
Type="number",
},
},
Returns=
{
{
Type="number",
},
},
Notes="Returns the coefficient for the line from the specified vector through this vector to reach the specified Z coord. The result satisfies the following equation: (this + Result * (Param - this)).z = Z. Returns the NO_INTERSECTION constant if there's no intersection.",
},
LineCoeffToXZPlane=
{
Params=
{
{
Name="Vector3d",
Type="Vector3d",
},
{
Name="Y",
Type="number",
},
},
Returns=
{
{
Type="number",
},
},
Notes="Returns the coefficient for the line from the specified vector through this vector to reach the specified Y coord. The result satisfies the following equation: (this + Result * (Param - this)).y = Y. Returns the NO_INTERSECTION constant if there's no intersection.",
},
LineCoeffToYZPlane=
{
Params=
{
{
Name="Vector3d",
Type="Vector3d",
},
{
Name="X",
Type="number",
},
},
Returns=
{
{
Type="number",
},
},
Notes="Returns the coefficient for the line from the specified vector through this vector to reach the specified X coord. The result satisfies the following equation: (this + Result * (Param - this)).x = X. Returns the NO_INTERSECTION constant if there's no intersection.",
},
Move=
{
{
Params=
{
{
Name="X",
Type="number",
},
{
Name="Y",
Type="number",
},
{
Name="Z",
Type="number",
},
},
Notes="Adds the specified offsets to each coord, effectively moving the vector by the specified coord offsets.",
},
{
Params=
{
{
Name="Diff",
Type="Vector3d",
},
},
Notes="Adds the specified vector to this vector. Is slightly better performant than adding with a \"+\" because this doesn't create a new object for the result.",
},
},
Normalize=
{
Notes="Changes this vector so that it keeps current direction but is exactly 1 unit long. FIXME: Fails for a zero vector.",
},
NormalizeCopy=
{
Returns=
{
{
Type="Vector3d",
},
},
Notes="Returns a new vector that has the same direction as this but is exactly 1 unit long. FIXME: Fails for a zero vector.",
Notes="Returns the (euclidean) length of this vector, squared. This operation is slightly less computationally expensive than Length(), while it conserves some properties of Length(), such as comparison. ",
},
TurnCCW=
{
Notes="Rotates the vector 90 degrees counterclockwise around the vertical axis. Note that this is specific to minecraft's axis ordering, which is X+ left, Z+ down.",
},
TurnCW=
{
Notes="Rotates the vector 90 degrees clockwise around the vertical axis. Note that this is specific to minecraft's axis ordering, which is X+ left, Z+ down.",
Notes="Creates a new Vector3f object with zero coords",
},
{
Params=
{
{
Name="x",
Type="number",
},
{
Name="y",
Type="number",
},
{
Name="z",
Type="number",
},
},
Returns=
{
{
Type="Vector3f",
},
},
Notes="Creates a new Vector3f object with the specified coords",
},
{
Params=
{
{
Name="Vector3f",
Type="Vector3f",
},
},
Returns=
{
{
Type="Vector3f",
},
},
Notes="Creates a new Vector3f object as a copy of the specified vector",
},
{
Params=
{
{
Name="Vector3d",
Type="Vector3d",
},
},
Returns=
{
{
Type="Vector3f",
},
},
Notes="Creates a new Vector3f object as a copy of the specified {{Vector3d}}",
},
{
Params=
{
{
Name="Vector3i",
Type="Vector3i",
},
},
Returns=
{
{
Type="Vector3f",
},
},
Notes="Creates a new Vector3f object as a copy of the specified {{Vector3i}}",
},
},
Cross=
{
Params=
{
{
Name="Other",
Type="Vector3f",
},
},
Returns=
{
{
Type="Vector3f",
},
},
Notes="Returns a new Vector3f object that holds the cross product of this vector and the specified vector.",
},
Dot=
{
Params=
{
{
Name="Other",
Type="Vector3f",
},
},
Returns=
{
{
Type="number",
},
},
Notes="Returns the dot product of this vector and the specified vector.",
},
Equals=
{
Params=
{
{
Name="Other",
Type="Vector3f",
},
},
Returns=
{
{
Type="boolean",
},
},
Notes="Returns true if the specified vector is exactly equal to this vector. Note that this is subject to (possibly imprecise) floating point math.",
},
EqualsEps=
{
Params=
{
{
Name="Other",
Type="Vector3f",
},
{
Name="Eps",
Type="number",
},
},
Returns=
{
{
Type="boolean",
},
},
Notes="Returns true if the differences between each corresponding coords of this vector and the one specified, are less than the specified Eps.",
},
Floor=
{
Returns=
{
{
Type="Vector3i",
},
},
Notes="Returns a new {{Vector3i}} object with coords set to math.floor of this vector's coords.",
},
HasNonZeroLength=
{
Returns=
{
{
Type="boolean",
},
},
Notes="Returns true if the vector has at least one coord non-zero. Note that this is subject to (possibly imprecise) floating point math.",
},
Length=
{
Returns=
{
{
Type="number",
},
},
Notes="Returns the (euclidean) length of this vector",
},
LineCoeffToXYPlane=
{
Params=
{
{
Name="Vector3f",
Type="Vector3f",
},
{
Name="Z",
Type="number",
},
},
Returns=
{
{
Type="number",
},
},
Notes="Returns the coefficient for the line from the specified vector through this vector to reach the specified Z coord. The result satisfies the following equation: (this + Result * (Param - this)).z = Z. Returns the NO_INTERSECTION constant if there's no intersection.",
},
LineCoeffToXZPlane=
{
Params=
{
{
Name="Vector3f",
Type="Vector3f",
},
{
Name="Y",
Type="number",
},
},
Returns=
{
{
Type="number",
},
},
Notes="Returns the coefficient for the line from the specified vector through this vector to reach the specified Y coord. The result satisfies the following equation: (this + Result * (Param - this)).y = Y. Returns the NO_INTERSECTION constant if there's no intersection.",
},
LineCoeffToYZPlane=
{
Params=
{
{
Name="Vector3f",
Type="Vector3f",
},
{
Name="X",
Type="number",
},
},
Returns=
{
{
Type="number",
},
},
Notes="Returns the coefficient for the line from the specified vector through this vector to reach the specified X coord. The result satisfies the following equation: (this + Result * (Param - this)).x = X. Returns the NO_INTERSECTION constant if there's no intersection.",
},
Move=
{
{
Params=
{
{
Name="X",
Type="number",
},
{
Name="Y",
Type="number",
},
{
Name="Z",
Type="number",
},
},
Notes="Adds the specified offsets to each coord, effectively moving the vector by the specified coord offsets.",
},
{
Params=
{
{
Name="Diff",
Type="Vector3f",
},
},
Notes="Adds the specified vector to this vector. Is slightly better performant than adding with a \"+\" because this doesn't create a new object for the result.",
},
},
Normalize=
{
Notes="Normalizes this vector (makes it 1 unit long while keeping the direction). FIXME: Fails for zero vectors.",
},
NormalizeCopy=
{
Returns=
{
{
Type="Vector3f",
},
},
Notes="Returns a copy of this vector that is normalized (1 unit long while keeping the same direction). FIXME: Fails for zero vectors.",
Notes="Returns a new Vector3f object that holds the vector differrence between this vector and the specified vector.",
},
{
Returns=
{
{
Type="Vector3f",
},
},
Notes="Returns a new Vector3f that is a negative of this vector (all coords multiplied by -1).",
},
},
Set=
{
Params=
{
{
Name="x",
Type="number",
},
{
Name="y",
Type="number",
},
{
Name="z",
Type="number",
},
},
Notes="Sets all the coords of the vector at once.",
},
SqrLength=
{
Returns=
{
{
Type="number",
},
},
Notes="Returns the (euclidean) length of this vector, squared. This operation is slightly less computationally expensive than Length(), while it conserves some properties of Length(), such as comparison.",
},
TurnCCW=
{
Notes="Rotates the vector 90 degrees counterclockwise around the vertical axis. Note that this is specific to minecraft's axis ordering, which is X+ left, Z+ down.",
Notes="Rotates the vector 90 degrees clockwise around the vertical axis. Note that this is specific to minecraft's axis ordering, which is X+ left, Z+ down.",
Notes="Creates a new Vector3i object with zero coords.",
},
{
Params=
{
{
Name="x",
Type="number",
},
{
Name="y",
Type="number",
},
{
Name="z",
Type="number",
},
},
Returns=
{
{
Type="Vector3i",
},
},
Notes="Creates a new Vector3i object with the specified coords.",
},
{
Params=
{
{
Name="Vector3d",
Type="Vector3d",
},
},
Returns=
{
{
Type="Vector3i",
},
},
Notes="Creates a new Vector3i object with coords copied and floor()-ed from the specified {{Vector3d}}.",
},
},
Cross=
{
Params=
{
{
Name="Other",
Type="Vector3d",
},
},
Returns=
{
{
Type="Vector3d",
},
},
Notes="Returns a new Vector3d that is a {{http://en.wikipedia.org/wiki/Cross_product|cross product}} of this vector and the specified vector.",
},
Dot=
{
Params=
{
{
Name="Other",
Type="Vector3d",
},
},
Returns=
{
{
Type="number",
},
},
Notes="Returns the dot product of this vector and the specified vector.",
},
Equals=
{
Params=
{
{
Name="Other",
Type="Vector3i",
},
},
Returns=
{
{
Type="boolean",
},
},
Notes="Returns true if this vector is exactly the same as the specified vector.",
},
EqualsEps=
{
Params=
{
{
Name="Other",
Type="Vector3i",
},
{
Name="Eps",
Type="number",
},
},
Returns=
{
{
Type="boolean",
},
},
Notes="Returns true if the differences between each corresponding coords of this vector and the one specified, are less than the specified Eps. Normally not too useful for integer-only vectors, but still included for API completeness.",
},
Floor=
{
Returns=
{
{
Type="Vector3i",
},
},
Notes="Returns a new {{Vector3i}} object with coords set to math.floor of this vector's coords. Normally not too useful with integer-only vectors, but still included for API completeness.",
},
HasNonZeroLength=
{
Returns=
{
{
Type="boolean",
},
},
Notes="Returns true if the vector has at least one coord non-zero.",
},
Length=
{
Returns=
{
{
Type="number",
},
},
Notes="Returns the (euclidean) length of this vector.",
},
LineCoeffToXYPlane=
{
Params=
{
{
Name="Vector3i",
Type="Vector3i",
},
{
Name="Z",
Type="number",
},
},
Returns=
{
{
Type="number",
},
},
Notes="Returns the coefficient for the line from the specified vector through this vector to reach the specified Z coord. The result satisfies the following equation: (this + Result * (Param - this)).z = Z. Returns the NO_INTERSECTION constant if there's no intersection.",
},
LineCoeffToXZPlane=
{
Params=
{
{
Name="Vector3i",
Type="Vector3i",
},
{
Name="Y",
Type="number",
},
},
Returns=
{
{
Type="number",
},
},
Notes="Returns the coefficient for the line from the specified vector through this vector to reach the specified Y coord. The result satisfies the following equation: (this + Result * (Param - this)).y = Y. Returns the NO_INTERSECTION constant if there's no intersection.",
},
LineCoeffToYZPlane=
{
Params=
{
{
Name="Vector3i",
Type="Vector3i",
},
{
Name="X",
Type="number",
},
},
Returns=
{
{
Type="number",
},
},
Notes="Returns the coefficient for the line from the specified vector through this vector to reach the specified X coord. The result satisfies the following equation: (this + Result * (Param - this)).x = X. Returns the NO_INTERSECTION constant if there's no intersection.",
},
Move=
{
{
Params=
{
{
Name="x",
Type="number",
},
{
Name="y",
Type="number",
},
{
Name="z",
Type="number",
},
},
Notes="Moves the vector by the specified amount in each axis direction.",
},
{
Params=
{
{
Name="Diff",
Type="Vector3i",
},
},
Notes="Adds the specified vector to this vector. Is slightly better performant than adding with a \"+\" because this doesn't create a new object for the result.",
},
},
Normalize=
{
Notes="Normalizes this vector (makes it 1 unit long while keeping the direction). Quite useless for integer-only vectors, since the normalized vector will almost always truncate to zero vector. FIXME: Fails for zero vectors.",
},
NormalizeCopy=
{
Returns=
{
{
Type="Vector3f",
},
},
Notes="Returns a copy of this vector that is normalized (1 unit long while keeping the same direction). Quite useless for integer-only vectors, since the normalized vector will almost always truncate to zero vector. FIXME: Fails for zero vectors.",
Notes="Returns a new Vector3i object that holds the vector differrence between this vector and the specified vector.",
},
{
Returns=
{
{
Type="Vector3i",
},
},
Notes="Returns a new Vector3i that is a negative of this vector (all coords multiplied by -1).",
},
},
Set=
{
Params=
{
{
Name="x",
Type="number",
},
{
Name="y",
Type="number",
},
{
Name="z",
Type="number",
},
},
Notes="Sets all the coords of the vector at once",
},
SqrLength=
{
Returns=
{
{
Type="number",
},
},
Notes="Returns the (euclidean) length of this vector, squared. This operation is slightly less computationally expensive than Length(), while it conserves some properties of Length(), such as comparison.",
Notes="Rotates the vector 90 degrees counterclockwise around the vertical axis. Note that this is specific to minecraft's axis ordering, which is X+ left, Z+ down.",
},
TurnCW=
{
Notes="Rotates the vector 90 degrees clockwise around the vertical axis. Note that this is specific to minecraft's axis ordering, which is X+ left, Z+ down.",
Notes="The max difference between two coords for which the coords are assumed equal (in LineCoeffToXYPlane() et al). Quite useless with integer-only vector.",
},
NO_INTERSECTION=
{
Notes="Special return value for the LineCoeffToXYPlane() et al meaning that there's no intersection with the plane.",