LuaDoc_point.md.html - yasumitsu/JaggedAlliance3Modding GitHub Wiki

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:

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:

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:

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:

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:

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:

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)

<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>
⚠️ **GitHub.com Fallback** ⚠️