diff options
author | Mattes D <github@xoft.cz> | 2016-09-13 09:43:02 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-09-13 09:43:02 +0200 |
commit | ca99e754ea430f500e79c5d929754c7e5946329b (patch) | |
tree | 5ea029a2a87d445f52ee80ca73c71e4bd37d3a0a /Server/Plugins/APIDump/Classes/Geometry.lua | |
parent | Bindings: Fixed some function signatures comments. (diff) | |
parent | CIBuild: Mark as failure on duplicate API docs. (diff) | |
download | cuberite-ca99e754ea430f500e79c5d929754c7e5946329b.tar cuberite-ca99e754ea430f500e79c5d929754c7e5946329b.tar.gz cuberite-ca99e754ea430f500e79c5d929754c7e5946329b.tar.bz2 cuberite-ca99e754ea430f500e79c5d929754c7e5946329b.tar.lz cuberite-ca99e754ea430f500e79c5d929754c7e5946329b.tar.xz cuberite-ca99e754ea430f500e79c5d929754c7e5946329b.tar.zst cuberite-ca99e754ea430f500e79c5d929754c7e5946329b.zip |
Diffstat (limited to '')
-rw-r--r-- | Server/Plugins/APIDump/Classes/Geometry.lua | 2593 |
1 files changed, 2391 insertions, 202 deletions
diff --git a/Server/Plugins/APIDump/Classes/Geometry.lua b/Server/Plugins/APIDump/Classes/Geometry.lua index b9d9cbd4e..fa0fe995a 100644 --- a/Server/Plugins/APIDump/Classes/Geometry.lua +++ b/Server/Plugins/APIDump/Classes/Geometry.lua @@ -22,49 +22,526 @@ return ]], Functions = { + CalcLineIntersection = + { + { + Params = + { + { + 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. 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.", + }, + }, constructor = { - { Params = "MinX, MaxX, MinY, MaxY, MinZ, MaxZ", Return = "cBoundingBox", Notes = "Creates a new bounding box with the specified edges" }, - { Params = "{{Vector3d|Min}}, {{Vector3d|Max}}", Return = "cBoundingBox", Notes = "Creates a new bounding box with the coords specified as two vectors" }, - { Params = "{{Vector3d|Pos}}, Radius, Height", Return = "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 = "OtherBoundingBox", Return = "cBoundingBox", Notes = "Creates a new copy of the given bounding box. Same result can be achieved by using a simple assignment." }, - { Params = "{{Vector3d|Pos}}, CubeSideLength", Return = "{{cBoundingBox}}", Notes = "Creates a new bounding box as a cube with the specified side length centered around the specified point." }, + { + Params = + { + { + Name = "MinX", + Type = "number", + }, + { + Name = "MaxX", + Type = "number", + }, + { + Name = "MinY", + Type = "number", + }, + { + Name = "MaxY", + Type = "number", + }, + { + Name = "MinZ", + Type = "number", + }, + { + Name = "MaxZ", + Type = "number", + }, + }, + Returns = + { + { + Type = "cBoundingBox", + }, + }, + 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.", + }, }, - CalcLineIntersection = + DoesIntersect = + { + Params = + { + { + Name = "OtherBoundingBox", + Type = "cBoundingBox", + }, + }, + Returns = + { + { + Type = "boolean", + }, + }, + Notes = "Returns true if the two bounding boxes have an intersection of nonzero volume.", + }, + Expand = + { + Params = + { + { + Name = "ExpandX", + Type = "number", + }, + { + Name = "ExpandY", + Type = "number", + }, + { + Name = "ExpandZ", + Type = "number", + }, + }, + Notes = "Expands this bounding box by the specified amount in each direction (so the box becomes larger by 2 * Expand in each axis).", + }, + GetMax = + { + Returns = + { + { + Name = "Point", + Type = "Vector3d", + }, + }, + Notes = "Returns the boundary point with the maximum coords", + }, + GetMaxX = + { + Returns = + { + { + Type = "number", + }, + }, + Notes = "Returns the maximum X coord of the bounding box", + }, + GetMaxY = + { + Returns = + { + { + Type = "number", + }, + }, + Notes = "Returns the maximum Y coord of the bounding box", + }, + GetMaxZ = + { + Returns = + { + { + Type = "number", + }, + }, + Notes = "Returns the maximum Z coord of the bounding box", + }, + GetMin = { - { Params = "{{Vector3d|LineStart}}, {{Vector3d|LinePt2}}", Return = "DoesIntersect, [LineCoeff, Face]", 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." }, - { Params = "{{Vector3d|BoxMin}}, {{Vector3d|BoxMax}}, {{Vector3d|LineStart}}, {{Vector3d|LinePt2}}", Return = "DoesIntersect, [LineCoeff, Face]", IsStatic = 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." }, - }, - DoesIntersect = { Params = "OtherBoundingBox", Return = "bool", Notes = "Returns true if the two bounding boxes have an intersection of nonzero volume." }, - Expand = { Params = "ExpandX, ExpandY, ExpandZ", Return = "", Notes = "Expands this bounding box by the specified amount in each direction (so the box becomes larger by 2 * Expand in each axis)." }, - GetMax = { Params = "", Return = "{{Vector3d|Point}}", Notes = "Returns the boundary point with the maximum coords" }, - GetMaxX = { Params = "", Return = "number", Notes = "Returns the maximum X coord of the bounding box" }, - GetMaxY = { Params = "", Return = "number", Notes = "Returns the maximum Y coord of the bounding box" }, - GetMaxZ = { Params = "", Return = "number", Notes = "Returns the maximum Z coord of the bounding box" }, - GetMin = { Params = "", Return = "{{Vector3d|Point}}", Notes = "Returns the boundary point with the minimum coords" }, - GetMinX = { Params = "", Return = "number", Notes = "Returns the minimum X coord of the bounding box" }, - GetMinY = { Params = "", Return = "number", Notes = "Returns the minimum Y coord of the bounding box" }, - GetMinZ = { Params = "", Return = "number", Notes = "Returns the minimum Z coord of the bounding box" }, - Intersect = { Params = "{{cBoundingBox|OtherBbox}}", Return = "bool, [{{cBoundingBox|bbox}}]", 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." }, + Returns = + { + { + Name = "Point", + Type = "Vector3d", + }, + }, + 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.", + }, IsInside = { - { Params = "{{Vector3d|Point}}", Return = "bool", Notes = "Returns true if the specified point is inside (including on the edge) of the box." }, - { Params = "PointX, PointY, PointZ", Return = "bool", Notes = "Returns true if the specified point is inside (including on the edge) of the box." }, - { Params = "OtherBoundingBox", Return = "bool", Notes = "Returns true if OtherBoundingBox is inside of this box." }, - { Params = "{{Vector3d|OtherBoxMin}}, {{Vector3d|OtherBoxMax}}", Return = "bool", Notes = "Returns true if the other bounding box, specified by its 2 corners, is inside of this box." }, - { Params = "{{Vector3d|Min}}, {{Vector3d|Max}}, {{Vector3d|Point}}", Return = "boolean", IsStatic = true, Notes = "Returns true if the specified point is inside the bounding box specified by its min / max corners" }, - { Params = "{{Vector3d|Min}}, {{Vector3d|Max}}, X, Y, Z", Return = "boolean", IsStatic = true, Notes = "Returns true if the specified point is inside the bounding box specified by its min / max corners" }, + { + Params = + { + { + Name = "Point", + Type = "Vector3d", + }, + }, + Returns = + { + { + Type = "boolean", + }, + }, + Notes = "Returns true if the specified point is inside (including on the edge) of the box.", + }, + { + Params = + { + { + Name = "PointX", + Type = "number", + }, + { + Name = "PointY", + Type = "number", + }, + { + Name = "PointZ", + Type = "number", + }, + }, + Returns = + { + { + Type = "boolean", + }, + }, + Notes = "Returns true if the specified point is inside (including on the edge) of the box.", + }, + { + Params = + { + { + Name = "OtherBoundingBox", + Type = "cBoundingBox", + }, + }, + Returns = + { + { + Type = "boolean", + }, + }, + Notes = "Returns true if OtherBoundingBox is inside of this box.", + }, + { + Params = + { + { + Name = "OtherBoxMin", + Type = "number", + }, + { + Name = "OtherBoxMax", + Type = "number", + }, + }, + Returns = + { + { + Type = "boolean", + }, + }, + Notes = "Returns true if the other bounding box, specified by its 2 corners, is inside of this box.", + }, + { + IsStatic = true, + Params = + { + { + Name = "Min", + Type = "number", + }, + { + Name = "Max", + Type = "number", + }, + { + Name = "Point", + Type = "Vector3d", + }, + }, + Returns = + { + { + Type = "boolean", + }, + }, + Notes = "Returns true if the specified point is inside the bounding box specified by its min / max corners", + }, + { + IsStatic = true, + Params = + { + { + Name = "Min", + Type = "number", + }, + { + Name = "Max", + Type = "number", + }, + { + Name = "X", + Type = "number", + }, + { + Name = "Y", + Type = "number", + }, + { + Name = "Z", + Type = "number", + }, + }, + Returns = + { + { + Type = "boolean", + }, + }, + Notes = "Returns true if the specified point is inside the bounding box specified by its min / max corners", + }, }, Move = { - { Params = "OffsetX, OffsetY, OffsetZ", Return = "", Notes = "Moves the bounding box by the specified offset in each axis" }, - { Params = "{{Vector3d|Offset}}", Return = "", Notes = "Moves the bounding box by the specified offset in each axis" }, + { + Params = + { + { + Name = "OffsetX", + Type = "number", + }, + { + Name = "OffsetY", + Type = "number", + }, + { + Name = "OffsetZ", + Type = "number", + }, + }, + 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.", }, - Union = { Params = "OtherBoundingBox", Return = "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." }, }, - }, -- cBoundingBox - - + }, cCuboid = { Desc = [[ @@ -77,51 +554,429 @@ return ]], Functions = { + Assign = + { + { + Params = + { + { + Name = "SrcCuboid", + Type = "cCuboid", + }, + }, + Notes = "Copies all the coords from the src cuboid to this cuboid. Sort-state is ignored.", + }, + { + Params = + { + { + Name = "X1", + Type = "number", + }, + { + Name = "Y1", + Type = "number", + }, + { + Name = "Z1", + Type = "number", + }, + { + Name = "X2", + Type = "number", + }, + { + Name = "Y2", + Type = "number", + }, + { + Name = "Z2", + Type = "number", + }, + }, + Notes = "Assigns all the coords to the specified values. Sort-state is ignored.", + }, + }, + ClampX = + { + Params = + { + { + Name = "MinX", + Type = "number", + }, + { + Name = "MaxX", + Type = "number", + }, + }, + Notes = "Clamps both X coords into the range provided. Sortedness-agnostic.", + }, + ClampY = + { + Params = + { + { + Name = "MinY", + Type = "number", + }, + { + Name = "MaxY", + Type = "number", + }, + }, + Notes = "Clamps both Y coords into the range provided. Sortedness-agnostic.", + }, + ClampZ = + { + Params = + { + { + Name = "MinZ", + Type = "number", + }, + { + Name = "MaxZ", + Type = "number", + }, + }, + Notes = "Clamps both Z coords into the range provided. Sortedness-agnostic.", + }, constructor = { - { Params = "", Return = "cCuboid", Notes = "Creates a new Cuboid object with all-zero coords" }, - { Params = "OtherCuboid", Return = "cCuboid", Notes = "Creates a new Cuboid object as a copy of OtherCuboid" }, - { Params = "{{Vector3i|Point1}}, {{Vector3i|Point2}}", Return = "cCuboid", Notes = "Creates a new Cuboid object with the specified points as its corners." }, - { Params = "X, Y, Z", Return = "cCuboid", Notes = "Creates a new Cuboid object with the specified point as both its corners (the cuboid has a size of 1 in each direction)." }, - { Params = "X1, Y1, Z1, X2, Y2, Z2", Return = "cCuboid", Notes = "Creates a new Cuboid object with the specified points as its corners." }, + { + Returns = + { + { + Type = "cCuboid", + }, + }, + Notes = "Creates a new Cuboid object with all-zero coords", + }, + { + Params = + { + { + Name = "OtherCuboid", + Type = "cCuboid", + }, + }, + Returns = + { + { + Type = "cCuboid", + }, + }, + Notes = "Creates a new Cuboid object as a copy of OtherCuboid", + }, + { + Params = + { + { + Name = "Point1", + Type = "Vector3i", + }, + { + Name = "Point2", + Type = "Vector3i", + }, + }, + Returns = + { + { + Type = "cCuboid", + }, + }, + Notes = "Creates a new Cuboid object with the specified points as its corners.", + }, + { + Params = + { + { + Name = "X", + Type = "number", + }, + { + Name = "Y", + Type = "number", + }, + { + Name = "Z", + Type = "number", + }, + }, + Returns = + { + { + Type = "cCuboid", + }, + }, + Notes = "Creates a new Cuboid object with the specified point as both its corners (the cuboid has a size of 1 in each direction).", + }, + { + Params = + { + { + Name = "X1", + Type = "number", + }, + { + Name = "Y1", + Type = "number", + }, + { + Name = "Z1", + Type = "number", + }, + { + Name = "X2", + Type = "number", + }, + { + Name = "Y2", + Type = "number", + }, + { + Name = "Z2", + Type = "number", + }, + }, + Returns = + { + { + Type = "cCuboid", + }, + }, + Notes = "Creates a new Cuboid object with the specified points as its corners.", + }, }, - Assign = + DifX = + { + Returns = + { + { + Type = "number", + }, + }, + Notes = "Returns the difference between the two X coords (X-size minus 1). Assumes sorted.", + }, + DifY = + { + Returns = + { + { + Type = "number", + }, + }, + Notes = "Returns the difference between the two Y coords (Y-size minus 1). Assumes sorted.", + }, + DifZ = + { + Returns = + { + { + Type = "number", + }, + }, + Notes = "Returns the difference between the two Z coords (Z-size minus 1). Assumes sorted.", + }, + DoesIntersect = + { + Params = + { + { + Name = "OtherCuboid", + Type = "cCuboid", + }, + }, + Returns = + { + { + Type = "boolean", + }, + }, + Notes = "Returns true if this cuboid has at least one voxel in common with OtherCuboid. Note that edges are considered inclusive. Assumes both sorted.", + }, + Engulf = { - { Params = "SrcCuboid", Return = "", Notes = "Copies all the coords from the src cuboid to this cuboid. Sort-state is ignored." }, - { Params = "X1, Y1, Z1, X2, Y2, Z2", Return = "", Notes = "Assigns all the coords to the specified values. Sort-state is ignored." }, - }, - ClampX = { Params = "MinX, MaxX", Return = "", Notes = "Clamps both X coords into the range provided. Sortedness-agnostic." }, - ClampY = { Params = "MinY, MaxY", Return = "", Notes = "Clamps both Y coords into the range provided. Sortedness-agnostic." }, - ClampZ = { Params = "MinZ, MaxZ", Return = "", Notes = "Clamps both Z coords into the range provided. Sortedness-agnostic." }, - DifX = { Params = "", Return = "number", Notes = "Returns the difference between the two X coords (X-size minus 1). Assumes sorted." }, - DifY = { Params = "", Return = "number", Notes = "Returns the difference between the two Y coords (Y-size minus 1). Assumes sorted." }, - DifZ = { Params = "", Return = "number", Notes = "Returns the difference between the two Z coords (Z-size minus 1). Assumes sorted." }, - DoesIntersect = { Params = "OtherCuboid", Return = "bool", Notes = "Returns true if this cuboid has at least one voxel in common with OtherCuboid. Note that edges are considered inclusive. Assumes both sorted." }, - Engulf = { Params = "{{Vector3i|Point}}", Return = "", Notes = "If needed, expands the cuboid to include the specified point. Doesn't shrink. Assumes sorted. " }, - Expand = { Params = "SubMinX, AddMaxX, SubMinY, AddMaxY, SubMinZ, AddMaxZ", Return = "", 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 = { Params = "", Return = "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 = "OuterCuboid", Return = "bool", Notes = "Returns true if this cuboid is completely inside (in all directions) in OuterCuboid. Assumes both sorted." }, + Params = + { + { + Name = "Point", + Type = "Vector3i", + }, + }, + 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.", + }, IsInside = { - { Params = "X, Y, Z", Return = "bool", Notes = "Returns true if the specified point (integral coords) is inside this cuboid. Assumes sorted." }, - { Params = "{{Vector3i|Point}}", Return = "bool", Notes = "Returns true if the specified point (integral coords) is inside this cuboid. Assumes sorted." }, - { Params = "{{Vector3d|Point}}", Return = "bool", Notes = "Returns true if the specified point (floating-point coords) is inside this cuboid. Assumes sorted." }, + { + Params = + { + { + Name = "X", + Type = "number", + }, + { + Name = "Y", + Type = "number", + }, + { + Name = "Z", + Type = "number", + }, + }, + Returns = + { + { + Type = "boolean", + }, + }, + Notes = "Returns true if the specified point (integral coords) is inside this cuboid. Assumes sorted.", + }, + { + Params = + { + { + Name = "Point", + Type = "Vector3i", + }, + }, + Returns = + { + { + Type = "boolean", + }, + }, + Notes = "Returns true if the specified point (integral coords) is inside this cuboid. Assumes sorted.", + }, + { + Params = + { + { + Name = "Point", + Type = "Vector3d", + }, + }, + Returns = + { + { + Type = "boolean", + }, + }, + Notes = "Returns true if the specified point (floating-point coords) is inside this cuboid. Assumes sorted.", + }, + }, + IsSorted = + { + Returns = + { + { + Type = "boolean", + }, + }, + Notes = "Returns true if this cuboid is sorted", + }, + Move = + { + Params = + { + { + Name = "OffsetX", + Type = "number", + }, + { + Name = "OffsetY", + Type = "number", + }, + { + Name = "OffsetZ", + Type = "number", + }, + }, + Notes = "Adds the specified offsets to each respective coord, effectively moving the Cuboid. Sort-state is ignored and preserved.", + }, + Sort = + { + Notes = "Sorts the internal representation so that p1 contains the lesser coords and p2 contains the greater coords.", }, - IsSorted = { Params = "", Return = "bool", Notes = "Returns true if this cuboid is sorted" }, - Move = { Params = "OffsetX, OffsetY, OffsetZ", Return = "", Notes = "Adds the specified offsets to each respective coord, effectively moving the Cuboid. Sort-state is ignored and preserved." }, - Sort = { Params = "", Return = "" , Notes = "Sorts the internal representation so that p1 contains the lesser coords and p2 contains the greater coords." }, }, Variables = { - p1 = { Type = "{{Vector3i}}", Notes = "The first corner. Usually the lesser of the two coords in each set" }, - p2 = { Type = "{{Vector3i}}", Notes = "The second corner. Usually the larger of the two coords in each set" }, + p1 = + { + Type = "{{Vector3i}}", + Notes = "The first corner. Usually the lesser of the two coords in each set", + }, + p2 = + { + Type = "{{Vector3i}}", + Notes = "The second corner. Usually the larger of the two coords in each set", + }, }, - }, -- cCuboid - - + }, cLineBlockTracer = { - Desc = [[This class provides an easy-to-use interface for tracing lines through individual + Desc = [[ +This class provides an easy-to-use interface for tracing lines through individual blocks in the world. It will call the provided callbacks according to what events it encounters along the way.</p> <p> @@ -131,9 +986,53 @@ various events. See below for further information. ]], Functions = { - Trace = { Params = "{{cWorld}}, Callbacks, StartX, StartY, StartZ, EndX, EndY, EndZ", Return = "bool", IsStatic = true, Notes = "Performs the trace on the specified line. Returns true if the entire trace was processed (no callback returned true)" }, + Trace = + { + IsStatic = true, + Params = + { + { + Name = "World", + Type = "cWorld", + }, + { + Name = "Callbacks", + Type = "table", + }, + { + Name = "StartX", + Type = "number", + }, + { + Name = "StartY", + Type = "number", + }, + { + Name = "StartZ", + Type = "number", + }, + { + Name = "EndX", + Type = "number", + }, + { + Name = "EndY", + Type = "number", + }, + { + Name = "EndZ", + Type = "number", + }, + }, + Returns = + { + { + Type = "boolean", + }, + }, + Notes = "Performs the trace on the specified line. Returns true if the entire trace was processed (no callback returned true)", + }, }, - AdditionalInfo = { { @@ -205,26 +1104,23 @@ end </p> ]], }, - }, -- AdditionalInfo - }, -- cLineBlockTracer - - + }, + }, cTracer = { Desc = [[ A cTracer object is used to trace lines in the world. One thing you can use the cTracer for, is tracing what block a player is looking at, but you can do more with it if you want.</p> <p> - The cTracer is still a work in progress.</p> + The cTracer is still a work in progress and is not documented at all.</p> <p> See also the {{cLineBlockTracer}} class for an alternative approach using callbacks. ]], Functions = { - }, - }, -- cTracer - + }, + }, Vector3d = { Desc = [[ @@ -235,67 +1131,489 @@ end ]], Functions = { + Abs = + { + Notes = "Updates each coord to its absolute value.", + }, + abs = + { + Notes = "<b>OBSOLETE</b>, use Abs() instead.", + }, + Clamp = + { + Params = + { + { + Name = "min", + Type = "number", + }, + { + Name = "max", + Type = "number", + }, + }, + Notes = "Clamps each coord into the specified range.", + }, + clamp = + { + Params = + { + { + Name = "min", + Type = "number", + }, + { + Name = "max", + Type = "number", + }, + }, + Notes = "<b>OBSOLETE</b>, use Clamp() instead.", + }, constructor = { - { Params = "{{Vector3f}}", Return = "Vector3d", Notes = "Creates a new Vector3d object by copying the coords from the given Vector3f." }, - { Params = "", Return = "Vector3d", Notes = "Creates a new Vector3d object with all its coords set to 0." }, - { Params = "X, Y, Z", Return = "Vector3d", Notes = "Creates a new Vector3d object with its coords set to the specified values." }, + { + Params = + { + { + Name = "Vector", + Type = "Vector3f", + }, + }, + Returns = + { + { + Type = "Vector3d", + }, + }, + Notes = "Creates a new Vector3d object by copying the coords from the given Vector3f.", + }, + { + Returns = + { + { + Type = "Vector3d", + }, + }, + Notes = "Creates a new Vector3d object with all its coords set to 0.", + }, + { + Params = + { + { + Name = "X", + Type = "number", + }, + { + Name = "Y", + Type = "number", + }, + { + Name = "Z", + Type = "number", + }, + }, + Returns = + { + { + Type = "Vector3d", + }, + }, + Notes = "Creates a new Vector3d object with its coords set to the specified values.", + }, + }, + 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 = "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.", }, operator_div = { - { Params = "{{Vector3d}}", Return = "{{Vector3d}}", Notes = "Returns a new Vector3d object with each coord divided by the corresponding coord from the given vector." }, - { Params = "number", Return = "Vector3d", Notes = "Returns a new Vector3d object with each coord divided by the specified number." }, + { + Params = + { + { + Name = "ParCoordDivisors", + Type = "Vector3d", + }, + }, + Returns = + { + { + Type = "Vector3d", + }, + }, + Notes = "Returns a new Vector3d object with each coord divided by the corresponding coord from the given vector.", + }, + { + Params = + { + { + Name = "Divisor", + Type = "number", + }, + }, + Returns = + { + { + Type = "Vector3d", + }, + }, + Notes = "Returns a new Vector3d object with each coord divided by the specified number.", + }, }, operator_mul = { - { Params = "{{Vector3d}}", Return = "{{Vector3d}}", Notes = "Returns a new Vector3d object with each coord multiplied by the corresponding coord from the given vector." }, - { Params = "number", Return = "Vector3d", Notes = "Returns a new Vector3d object with each coord multiplied." }, + { + Params = + { + { + Name = "PerCoordMultiplier", + Type = "Vector3d", + }, + }, + Returns = + { + { + Type = "Vector3d", + }, + }, + Notes = "Returns a new Vector3d object with each coord multiplied by the corresponding coord from the given vector.", + }, + { + Params = + { + { + Name = "Multiplier", + Type = "number", + }, + }, + Returns = + { + { + Type = "Vector3d", + }, + }, + Notes = "Returns a new Vector3d object with each coord multiplied.", + }, + }, + operator_plus = + { + Params = + { + { + Name = "Addend", + Type = "Vector3d", + }, + }, + Returns = + { + { + Type = "Vector3d", + }, + }, + Notes = "Returns a new Vector3d containing the sum of this vector and the specified vector", }, - operator_plus = {Params = "Vector3d", Return = "Vector3d", Notes = "Returns a new Vector3d containing the sum of this vector and the specified vector" }, operator_sub = { - { Params = "{{Vector3d}}", Return = "{{Vector3d}}", Notes = "Returns a new Vector3d object containing the difference between this object and the specified vector." }, - { Params = "", Return = "{{Vector3d}}", Notes = "Returns a new Vector3d object that is a negative of this vector (all coords multiplied by -1)." }, - }, - abs = { Params = "", Return = "", Notes = "<b>OBSOLETE</b>, use Abs() instead." }, - clamp = { Params = "min, max", Return = "", Notes = "<b>OBSOLETE</b>, use Clamp() instead." }, - Abs = { Params = "", Return = "", Notes = "Updates each coord to its absolute value." }, - Clamp = { Params = "min, max", Return = "", Notes = "Clamps each coord into the specified range." }, - Cross = { Params = "Vector3d", Return = "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 = "Vector3d", Return = "number", Notes = "Returns the dot product of this vector and the specified vector." }, - Equals = { Params = "Vector3d", Return = "bool", 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 = "{{Vector3d|Rhs}}, Eps", Return = "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 = { Params = "", Return = "{{Vector3i}}", Notes = "Returns a new {{Vector3i}} object with coords set to math.floor of this vector's coords." }, - HasNonZeroLength = { Params = "", Return = "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 = { Params = "", Return = "number", Notes = "Returns the (euclidean) length of the vector." }, - LineCoeffToXYPlane = { Params = "Vector3d, Z", Return = "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 = "Vector3d, Y", Return = "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 = "Vector3d, X", Return = "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 = "Subtrahend", + Type = "Vector3d", + }, + }, + Returns = + { + { + Type = "Vector3d", + }, + }, + Notes = "Returns a new Vector3d object containing the difference between this object and the specified vector.", + }, + { + Returns = + { + { + Type = "Vector3d", + }, + }, + Notes = "Returns a new Vector3d object that is a negative of this vector (all coords multiplied by -1).", + }, + }, + Set = { - { Params = "X, Y, Z", Return = "", Notes = "Adds the specified offsets to each coord, effectively moving the vector by the specified coord offsets." }, - { Params = "{{Vector3d|Diff}}", Return = "", 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." }, + Params = + { + { + Name = "X", + Type = "number", + }, + { + Name = "Y", + Type = "number", + }, + { + Name = "Z", + Type = "number", + }, + }, + Notes = "Sets all the coords in this object.", + }, + 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.", + }, + 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.", }, - Normalize = { Params = "", Return = "", Notes = "Changes this vector so that it keeps current direction but is exactly 1 unit long. FIXME: Fails for a zero vector." }, - NormalizeCopy = { Params = "", Return = "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." }, - Set = { Params = "X, Y, Z", Return = "", Notes = "Sets all the coords in this object." }, - SqrLength = { Params = "", Return = "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 = { Params = "", Return = "", 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 = { Params = "", Return = "", 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." }, }, Constants = { - EPS = { Notes = "The max difference between two coords for which the coords are assumed equal (in LineCoeffToXYPlane() et al)." }, - NO_INTERSECTION = { Notes = "Special return value for the LineCoeffToXYPlane() et al meaning that there's no intersection with the plane." }, + EPS = + { + Notes = "The max difference between two coords for which the coords are assumed equal (in LineCoeffToXYPlane() et al).", + }, + NO_INTERSECTION = + { + Notes = "Special return value for the LineCoeffToXYPlane() et al meaning that there's no intersection with the plane.", + }, }, Variables = { - x = { Type = "number", Notes = "The X coord of the vector." }, - y = { Type = "number", Notes = "The Y coord of the vector." }, - z = { Type = "number", Notes = "The Z coord of the vector." }, + x = + { + Type = "number", + Notes = "The X coord of the vector.", + }, + y = + { + Type = "number", + Notes = "The Y coord of the vector.", + }, + z = + { + Type = "number", + Notes = "The Z coord of the vector.", + }, }, - }, -- Vector3d - + }, Vector3f = { Desc = [[ @@ -306,69 +1624,521 @@ end ]], Functions = { + Abs = + { + Notes = "Updates each coord to its absolute value.", + }, + abs = + { + Notes = "<b>OBSOLETE</b>, use Abs() instead.", + }, + Clamp = + { + Params = + { + { + Name = "min", + Type = "number", + }, + { + Name = "max", + Type = "number", + }, + }, + Notes = "Clamps each coord into the specified range.", + }, + clamp = + { + Params = + { + { + Name = "min", + Type = "number", + }, + { + Name = "max", + Type = "number", + }, + }, + Notes = "<b>OBSOLETE</b>, use Clamp() instead.", + }, constructor = { - { Params = "", Return = "Vector3f", Notes = "Creates a new Vector3f object with zero coords" }, - { Params = "x, y, z", Return = "Vector3f", Notes = "Creates a new Vector3f object with the specified coords" }, - { Params = "Vector3f", Return = "Vector3f", Notes = "Creates a new Vector3f object as a copy of the specified vector" }, - { Params = "{{Vector3d}}", Return = "Vector3f", Notes = "Creates a new Vector3f object as a copy of the specified {{Vector3d}}" }, - { Params = "{{Vector3i}}", Return = "Vector3f", Notes = "Creates a new Vector3f object as a copy of the specified {{Vector3i}}" }, + { + Returns = + { + { + Type = "Vector3f", + }, + }, + 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.", }, operator_div = { - { Params = "{{Vector3f}}", Return = "{{Vector3f}}", Notes = "Returns a new Vector3f object with each coord divided by the corresponding coord from the given vector." }, - { Params = "number", Return = "{{Vector3f}}", Notes = "Returns a new Vector3f object with each coord divided by the specified number." }, + { + Params = + { + { + Name = "PerCoordDivisor", + Type = "Vector3f", + }, + }, + Returns = + { + { + Type = "Vector3f", + }, + }, + Notes = "Returns a new Vector3f object with each coord divided by the corresponding coord from the given vector.", + }, + { + Params = + { + { + Name = "Divisor", + Type = "number", + }, + }, + Returns = + { + { + Type = "Vector3f", + }, + }, + Notes = "Returns a new Vector3f object with each coord divided by the specified number.", + }, }, operator_mul = { - { Params = "number", Return = "{{Vector3f}}", Notes = "Returns a new Vector3f object that has each of its coords multiplied by the specified number" }, - { Params = "{{Vector3f}}", Return = "{{Vector3f}}", Notes = "Returns a new Vector3f object that has each of its coords multiplied by the respective coord of the specified vector." }, + { + Params = + { + { + Name = "PerCoordMultiplier", + Type = "number", + }, + }, + Returns = + { + { + Type = "Vector3f", + }, + }, + Notes = "Returns a new Vector3f object that has each of its coords multiplied by the specified number", + }, + { + Params = + { + { + Name = "Multiplier", + Type = "Vector3f", + }, + }, + Returns = + { + { + Type = "Vector3f", + }, + }, + Notes = "Returns a new Vector3f object that has each of its coords multiplied by the respective coord of the specified vector.", + }, + }, + operator_plus = + { + Params = + { + { + Name = "Other", + Type = "Vector3f", + }, + }, + Returns = + { + { + Type = "Vector3f", + }, + }, + Notes = "Returns a new Vector3f object that holds the vector sum of this vector and the specified vector.", }, - operator_plus = { Params = "Vector3f", Return = "Vector3f", Notes = "Returns a new Vector3f object that holds the vector sum of this vector and the specified vector." }, operator_sub = { - { Params = "Vector3f", Return = "Vector3f", Notes = "Returns a new Vector3f object that holds the vector differrence between this vector and the specified vector." }, - { Params = "", Return = "{{Vector3f}}", Notes = "Returns a new Vector3f that is a negative of this vector (all coords multiplied by -1)." }, - }, - abs = { Params = "", Return = "", Notes = "<b>OBSOLETE</b>, use Abs() instead." }, - clamp = { Params = "min, max", Return = "", Notes = "<b>OBSOLETE</b>, use Clamp() instead." }, - Abs = { Params = "", Return = "", Notes = "Updates each coord to its absolute value." }, - Clamp = { Params = "min, max", Return = "", Notes = "Clamps each coord into the specified range." }, - Cross = { Params = "Vector3f", Return = "Vector3f", Notes = "Returns a new Vector3f object that holds the cross product of this vector and the specified vector." }, - Dot = { Params = "Vector3f", Return = "number", Notes = "Returns the dot product of this vector and the specified vector." }, - Equals = { Params = "Vector3f", Return = "bool", 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 = "{{Vector3f|Rhs}}, Eps", Return = "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 = { Params = "", Return = "{{Vector3i}}", Notes = "Returns a new {{Vector3i}} object with coords set to math.floor of this vector's coords." }, - HasNonZeroLength = { Params = "", Return = "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 = { Params = "", Return = "number", Notes = "Returns the (euclidean) length of this vector" }, - LineCoeffToXYPlane = { Params = "Vector3f, Z", Return = "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 = "Vector3f, Y", Return = "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 = "Vector3f, X", Return = "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 = "Subtrahend", + Type = "Vector3f", + }, + }, + Returns = + { + { + Type = "Vector3f", + }, + }, + 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.", + }, + TurnCW = { - { Params = "X, Y, Z", Return = "", Notes = "Adds the specified offsets to each coord, effectively moving the vector by the specified coord offsets." }, - { Params = "{{Vector3f|Diff}}", Return = "", 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." }, + 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.", }, - Normalize = { Params = "", Return = "", Notes = "Normalizes this vector (makes it 1 unit long while keeping the direction). FIXME: Fails for zero vectors." }, - NormalizeCopy = { Params = "", Return = "Vector3f", Notes = "Returns a copy of this vector that is normalized (1 unit long while keeping the same direction). FIXME: Fails for zero vectors." }, - Set = { Params = "x, y, z", Return = "", Notes = "Sets all the coords of the vector at once." }, - SqrLength = { Params = "", Return = "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 = { Params = "", Return = "", 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 = { Params = "", Return = "", 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." }, }, Constants = { - EPS = { Notes = "The max difference between two coords for which the coords are assumed equal (in LineCoeffToXYPlane() et al)." }, - NO_INTERSECTION = { Notes = "Special return value for the LineCoeffToXYPlane() et al meaning that there's no intersection with the plane." }, + EPS = + { + Notes = "The max difference between two coords for which the coords are assumed equal (in LineCoeffToXYPlane() et al).", + }, + NO_INTERSECTION = + { + Notes = "Special return value for the LineCoeffToXYPlane() et al meaning that there's no intersection with the plane.", + }, }, Variables = { - x = { Type = "number", Notes = "The X coord of the vector." }, - y = { Type = "number", Notes = "The Y coord of the vector." }, - z = { Type = "number", Notes = "The Z coord of the vector." }, + x = + { + Type = "number", + Notes = "The X coord of the vector.", + }, + y = + { + Type = "number", + Notes = "The Y coord of the vector.", + }, + z = + { + Type = "number", + Notes = "The Z coord of the vector.", + }, }, - }, -- Vector3f - + }, Vector3i = { Desc = [[ @@ -379,68 +2149,487 @@ end ]], Functions = { + Abs = + { + Notes = "Updates each coord to its absolute value.", + }, + abs = + { + Notes = "<b>OBSOLETE</b>, use Abs() instead.", + }, + Clamp = + { + Params = + { + { + Name = "min", + Type = "number", + }, + { + Name = "max", + Type = "number", + }, + }, + Notes = "Clamps each coord into the specified range.", + }, + clamp = + { + Params = + { + { + Name = "min", + Type = "number", + }, + { + Name = "max", + Type = "number", + }, + }, + Notes = "<b>OBSOLETE</b>, use Clamp() instead.", + }, constructor = { - { Params = "", Return = "Vector3i", Notes = "Creates a new Vector3i object with zero coords." }, - { Params = "x, y, z", Return = "Vector3i", Notes = "Creates a new Vector3i object with the specified coords." }, - { Params = "{{Vector3d}}", Return = "Vector3i", Notes = "Creates a new Vector3i object with coords copied and floor()-ed from the specified {{Vector3d}}." }, + { + Returns = + { + { + Type = "Vector3i", + }, + }, + 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.", }, operator_div = { - { Params = "number", Return = "Vector3i", Notes = "Returns a new Vector3i object that has each of its coords divided by the specified number" }, - { Params = "Vector3i", Return = "Vector3i", Notes = "Returns a new Vector3i object that has each of its coords divided by the respective coord of the specified vector." }, + { + Params = + { + { + Name = "Divisor", + Type = "number", + }, + }, + Returns = + { + { + Type = "Vector3i", + }, + }, + Notes = "Returns a new Vector3i object that has each of its coords divided by the specified number", + }, + { + Params = + { + { + Name = "PerCoordDivisors", + Type = "Vector3i", + }, + }, + Returns = + { + { + Type = "Vector3i", + }, + }, + Notes = "Returns a new Vector3i object that has each of its coords divided by the respective coord of the specified vector.", + }, }, operator_mul = { - { Params = "number", Return = "Vector3i", Notes = "Returns a new Vector3i object that has each of its coords multiplied by the specified number" }, - { Params = "Vector3i", Return = "Vector3i", Notes = "Returns a new Vector3i object that has each of its coords multiplied by the respective coord of the specified vector." }, + { + Params = + { + { + Name = "Multiplier", + Type = "number", + }, + }, + Returns = + { + { + Type = "Vector3i", + }, + }, + Notes = "Returns a new Vector3i object that has each of its coords multiplied by the specified number", + }, + { + Params = + { + { + Name = "PerCoordMultipliers", + Type = "Vector3i", + }, + }, + Returns = + { + { + Type = "Vector3i", + }, + }, + Notes = "Returns a new Vector3i object that has each of its coords multiplied by the respective coord of the specified vector.", + }, + }, + operator_plus = + { + Params = + { + { + Name = "Addend", + Type = "Vector3i", + }, + }, + Returns = + { + { + Type = "Vector3i", + }, + }, + Notes = "Returns a new Vector3f object that holds the vector sum of this vector and the specified vector.", }, - operator_plus = { Params = "Vector3i", Return = "Vector3i", Notes = "Returns a new Vector3f object that holds the vector sum of this vector and the specified vector." }, operator_sub = { - { Params = "Vector3i", Return = "Vector3i", Notes = "Returns a new Vector3i object that holds the vector differrence between this vector and the specified vector." }, - { Params = "", Return = "{{Vector3i}}", Notes = "Returns a new Vector3i that is a negative of this vector (all coords multiplied by -1)." }, - }, - abs = { Params = "", Return = "", Notes = "<b>OBSOLETE</b>, use Abs() instead." }, - clamp = { Params = "min, max", Return = "", Notes = "<b>OBSOLETE</b>, use Clamp() instead." }, - Abs = { Params = "", Return = "", Notes = "Updates each coord to its absolute value." }, - Clamp = { Params = "min, max", Return = "", Notes = "Clamps each coord into the specified range." }, - Cross = { Params = "Vector3d", Return = "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 = "Vector3d", Return = "number", Notes = "Returns the dot product of this vector and the specified vector." }, - Equals = { Params = "Vector3i", Return = "bool", Notes = "Returns true if this vector is exactly the same as the specified vector." }, - EqualsEps = { Params = "{{Vector3i|Rhs}}, Eps", Return = "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 = { Params = "", Return = "{{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 = { Params = "", Return = "boolean", Notes = "Returns true if the vector has at least one coord non-zero." }, - Length = { Params = "", Return = "number", Notes = "Returns the (euclidean) length of this vector." }, - LineCoeffToXYPlane = { Params = "Vector3i, Z", Return = "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 = "Vector3i, Y", Return = "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 = "Vector3i, X", Return = "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 = "Subtrahend", + Type = "Vector3i", + }, + }, + Returns = + { + { + Type = "Vector3i", + }, + }, + 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.", + }, + TurnCCW = { - { Params = "x, y, z", Return = "", Notes = "Moves the vector by the specified amount in each axis direction." }, - { Params = "{{Vector3i|Diff}}", Return = "", 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." }, + 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.", }, - Normalize = { Params = "", Return = "", 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 = { Params = "", Return = "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." }, - Set = { Params = "x, y, z", Return = "", Notes = "Sets all the coords of the vector at once" }, - SqrLength = { Params = "", Return = "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 = { Params = "", Return = "", 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 = { Params = "", Return = "", 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." }, }, Constants = { - EPS = { 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." }, + EPS = + { + 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.", + }, }, Variables = { - x = { Type = "number", Notes = "The X coord of the vector." }, - y = { Type = "number", Notes = "The Y coord of the vector." }, - z = { Type = "number", Notes = "The Z coord of the vector." }, + x = + { + Type = "number", + Notes = "The X coord of the vector.", + }, + y = + { + Type = "number", + Notes = "The Y coord of the vector.", + }, + z = + { + Type = "number", + Notes = "The Z coord of the vector.", + }, }, - }, -- Vector3i + }, } - - - - |