| # point reference |
|
|
|
|
| ## point:AddX |
|
|
| Returns a point with the X coordinate changed by the parameter. If the parameter is zero, the original point is returned to avoid an allocation. |
|
|
|
|
|
|
| Pseudocode: |
|
|
| ~~~~ Lua |
| function point:AddX(x0) |
| return point(self.x + x0, self.y, self.z) |
| ~~~~ |
|
|
| point **point:AddX**(number x0) |
| number x0 |
| : value to add to the x coordinate |
|
|
| _returns_ point |
| : new point with the x coordinate increased by x0 |
|
|
|
|
| ## point:AddY |
|
|
| Returns a point with the Y coordinate changed by the parameter. If the parameter is zero, the original point is returned to avoid an allocation. |
|
|
|
|
|
|
| Pseudocode: |
|
|
| ~~~~ Lua |
| function point:AddY(y0) |
| return point(self.x, self.y + y0, self.z) |
| ~~~~ |
|
|
| point **point:AddY**(number y0) |
| number y0 |
| : value to add to the y coordinate |
|
|
| _returns_ point |
| : new point with the y coordinate increased by y0 |
|
|
|
|
| ## point:AddZ |
|
|
| Returns a point with the Z coordinate changed by the parameter. |
|
|
|
|
|
|
| Pseudocode: |
|
|
| ~~~~ Lua |
| function point:AddZ(z0) |
| return point(self.x, self.y, self.z + z0) |
| ~~~~ |
|
|
| point **point:AddZ**(number z0) |
| number z0 |
| : value to add to the z coordinate |
|
|
| _returns_ point |
| : new point with the z coordinate increased by z0 |
|
|
|
|
| ## point:InplaceAdd |
|
|
| Add to the coordinates of an existing point inplace (without creating another point). |
|
|
|
|
| point **point:InplaceAdd**(number x, number y[, number z]) |
|
|
| point **point:InplaceAdd**(point other) |
| _returns_ point |
| : the point itself |
|
|
|
|
| ## point:InplaceAddX |
|
|
| Add to the x coordinate of an existing point inplace (without creating another point). |
|
|
|
|
| point **point:InplaceAddX**(number x) |
| _returns_ point |
| : the point itself |
|
|
|
|
| ## point:InplaceAddY |
|
|
| Add to the y coordinate of an existing point inplace (without creating another point). |
|
|
|
|
| point **point:InplaceAddY**(number y) |
| _returns_ point |
| : the point itself |
|
|
|
|
| ## point:InplaceAddZ |
|
|
| Add to the z coordinate of an existing point inplace (without creating another point). |
|
|
|
|
| point **point:InplaceAddZ**(number z) |
| _returns_ point |
| : the point itself |
|
|
|
|
| ## point:InplaceSet |
|
|
| Set the coordinates of an existing point inplace (without creating another point). |
|
|
|
|
| point **point:InplaceSet**(number x, number y[, number z]) |
|
|
| point **point:InplaceSet**(point other) |
| _returns_ point |
| : the point itself |
|
|
|
|
| ## point:InplaceSetX |
|
|
| Set the x coordinate of an existing point inplace (without creating another point). |
|
|
|
|
| point **point:InplaceSetX**(number x) |
| _returns_ point |
| : the point itself |
|
|
|
|
| ## point:InplaceSetY |
|
|
| Set the y coordinate of an existing point inplace (without creating another point). |
|
|
|
|
| point **point:InplaceSetY**(number y) |
| _returns_ point |
| : the point itself |
|
|
|
|
| ## point:InplaceSetZ |
|
|
| Set the z coordinate of an existing point inplace (without creating another point). |
|
|
|
|
| point **point:InplaceSetZ**(number z) |
| _returns_ point |
| : the point itself |
|
|
|
|
| ## point:IsValidZ |
|
|
| Checks if the point has a valid Z coordinate. |
|
|
|
|
|
|
|
|
| bool **point:IsValidZ**() |
| _returns_ bool |
| : true if the point's Z coordinate is valid (i.e. different from the special value InvalidZ, denoting on-the-terrain points). |
|
|
|
|
| ## point:Normalize |
|
|
| Returns a point with the same vector direction, but with vector length 4096. If z == InvalidZ, normalizes only in the 2D plane XY coordinates. |
|
|
|
|
| point **point:Normalize**() |
| _returns_ point n |
| : a point with length 4096 with the same direction as the original point. |
|
|
|
|
| ## point:SetInvalidZ |
|
|
| Returns a new point with the Z coordinate set to the special value InvalidZ, denoting a point on the terrain surface. |
|
|
|
|
| point **point:SetInvalidZ**() |
|
|
| ## point:SetLen |
|
|
| Returns a point with the same vector direction, but with set vector length. If z == InvalidZ, only sets the length of the XY coordinates. |
|
|
|
|
| point **point:SetLen**(int len) |
| int len |
| : desired vector length of the output point. |
|
|
| _returns_ point p |
| : a point with vector length set to *len* and the same direction as the original point. |
|
|
|
|
| ## point:SetLen2D |
|
|
| Returns a point with the same vector direction in the XY plane, but with a set vector len. Ignores the Z coordinate of the original point. Sets the output Z to InvalidZ. |
|
|
|
|
| point **point:SetLen2D**(int len) |
| int len |
| : desired vector length of the output point. |
|
|
| _returns_ point p |
| : a point with vector length in the XY plane set to *len*, z == InvalidZ, and the same direction as the original point. |
|
|
|
|
| ## point:SetTerrainZ |
|
|
| Returns a new point with Z set to the terrain/walkable height at these XY coordintes. |
|
|
|
|
| point **point:SetTerrainZ**() |
| _returns_ point |
| : a new point with Z set to the terrain/walkable height at XY |
|
|
|
|
| ## point:SetX |
|
|
| Returns a point with the X coordinate set to the parameter. |
|
|
|
|
|
|
| Pseudocode: |
|
|
| ~~~~ Lua |
| function point:SetX(x0) |
| return point(x0, self.y, self.z) |
| ~~~~ |
|
|
| point **point:SetX**(number x0) |
| number x0 |
| : new x coordinate value |
|
|
| _returns_ point |
| : new point with the x coordinate set to x0 |
|
|
|
|
| ## point:SetY |
|
|
| Returns a point with the Y coordinate set to the parameter. If the parameter is equal to the current coordinate value, the original point is returned to avoid an allocation. |
|
|
|
|
|
|
| Pseudocode: |
|
|
| ~~~~ Lua |
| function point:SetY(y0) |
| return point(self.x, y0, self.z) |
| ~~~~ |
|
|
| point **point:SetY**(number y0) |
| number y0 |
| : new y coordinate value |
|
|
| _returns_ point |
| : new point with the y coordinate set to y0 |
|
|
|
|
| ## point:SetZ |
|
|
| Returns a point with the Z coordinate set to the parameter. |
|
|
|
|
|
|
| Pseudocode: |
|
|
| ~~~~ Lua |
| function point:SetZ(z0) |
| return point(self.x, self.y, z0) |
| ~~~~ |
|
|
| point **point:SetZ**(number z0) |
| number z0 |
| : new z coordinate value |
|
|
| _returns_ point |
| : new point with the z coordinate set to z0 |
|
|
|
|
| ## point:x |
|
|
| Returns the x coordinate of the point. |
|
|
|
|
|
|
|
|
| number **point:x**() |
| _returns_ x |
| : the x coordinate of the point |
|
|
|
|
| ## point:xy |
|
|
| Returns the x and y coordinates of the point. |
|
|
|
|
|
|
|
|
| number, number **point:xy**() |
| _returns_ x, y |
| : the x and y coordinates of the point |
|
|
|
|
| ## point:xyz |
|
|
| Returns the coordinates of the point. Two return values are returned if the point has InvalidZ. |
|
|
|
|
|
|
|
|
| number, number, number **point:xyz**() |
| _returns_ x, y, z |
| : the coordinate of the point |
|
|
|
|
| ## point:y |
|
|
| Returns the y coordinate of the point. |
|
|
|
|
|
|
|
|
| number **point:y**() |
| _returns_ y |
| : the y coordinate of the point |
|
|
|
|
| ## point:z |
|
|
| Returns the z coordinate of the point. |
|
|
|
|
|
|
|
|
| number **point:z**() |
| _returns_ z |
| : the z coordinate of the point, or nil if it's InvalidZ |
|
|
|
|
| ## LimitLen |
|
|
| Returns a point with the same vector direction, but with vector length limited to the specified length. If the point already has a vector length no greater than the parameter, returns it unmodified. |
|
|
|
|
| point **LimitLen**(point pt, int length) |
| _returns_ point |
| : a new point with the same vector direction as the original point |
|
|
|
|
| ## point |
|
|
| Creates a point from two or three number coordinates. If only two are supplied, Z = InvalidZ (the point is on the terrain). |
|
|
|
|
|
|
|
|
| point **point**(number x, number y [, number z]) |
| x, y, z |
| : the coordinates of the new point |
|
|
| _returns_ point |
| : the created point |
|
|
|
|
|
|
|
|
|
|
| (insert footer.md.html here) |
| <link rel="stylesheet" type="text/css" href="Style.css" /> |
| <style class="fallback">body{visibility:hidden;white-space:pre;font-family:monospace}</style><script src="markdeep.min.js" charset="utf-8"></script><script>window.alreadyProcessedMarkdeep||(document.body.style.visibility="visible")</script> |