From 07d2ceb9c06f5f7768e3f273b5c76b7d64013450 Mon Sep 17 00:00:00 2001 From: Josh Holtrop Date: Wed, 25 Nov 2009 01:02:31 +0000 Subject: [PATCH] finished std library documentation git-svn-id: svn://anubis/anaglym/trunk@195 99a6e188-d820-4881-8870-2d33a10e2619 --- doc/index.html | 83 ++++++++++++++++++++++++++++++++++---------------- 1 file changed, 56 insertions(+), 27 deletions(-) diff --git a/doc/index.html b/doc/index.html index 3337963..154d669 100644 --- a/doc/index.html +++ b/doc/index.html @@ -324,7 +324,7 @@ These objects are "managed" by the Lua script (as opposed to having all of their attributes defined in a model file). The properties of managed objects, such as the color, texture, position, and rotation, can be controlled by using the -object member functions. +object member methods.

@@ -333,6 +333,7 @@ and rotation, can be controlled by using the

This function creates a managed object which is a box with dimensions given by (width, depth, height). +The center of the box is initially located at the origin.

@@ -365,25 +366,6 @@ Identical to ag.createCapsule() except that the created object is static.

-
-

createCylinder

-

obj = ag.createCylinder(radius, length)

-

-This function creates a cylinder managed object. -radius specifies the radius of the cylinder. -length specifies the length of the cylinder. -The cylinder is oriented with its axis along the Z axis and its -center point at the origin. -

- -
-

createCylinderStatic

-

obj = ag.createCylinderStatic(radius, length)

-

-Identical to ag.createCylinder() except that the created -object is static. -

-

createPlane

1) obj = ag.createPlane(a, b, c, d)

@@ -401,7 +383,8 @@ angles around the x, y, and z axis. Specifying no rotation would use the default plane normal of (0, 0, 1). If you would like to create a plane by specifying a point on the surface and the surface normal, see the -
std.createPlanePtNormal() function. +std.createPlanePointNormal() +function.

@@ -409,6 +392,7 @@ the surface and the surface normal, see the

obj = ag.createSphere(radius)

This function creates a managed sphere object with the radius given. +The center of the sphere is initially located at the origin.

@@ -446,7 +430,7 @@ relative to the local reference frame of obj.

obj:addTorque(xr, yr, zr)

This function adds torque (a rotational force) to obj. -The torque vector around global axes x, y, z is given by (xr, yr, zr). +The torque vector around global x, y, and z axes is given by (xr, yr, zr).

@@ -454,7 +438,7 @@ The torque vector around global axes x, y, z is given by (xr, yr, zr).

obj:addTorqueRel(xr, yr, zr)

This function adds torque (a rotational force) to obj. -The torque vector around the local axes x, y, z of obj +The torque vector around obj's local x, y, and z axes is given by (xr, yr, zr).

@@ -463,11 +447,11 @@ is given by (xr, yr, zr).

new_obj = obj:clone()

This function makes a copy of the object in the engine. -This is more efficient then recreating the object in whatever +This is more efficient than creating a new object in whatever manner was used to create obj. new_obj will have all of its own parameters - position, rotation, color, texture, etc... -However, these parameters will be instantiated with the corresponding +However, these parameter values will be instantiated with the corresponding values from obj at the time of cloning. One should call new_obj:setPosition() @@ -541,7 +525,7 @@ center-of-mass (local origin) to (x, y, z).

setRotation

obj:setRotation(xr, yr, zr)

-This function sets the object's rotation to that specified +This function sets the object's rotation as specified by Euler angles (xr, yr, zr).

@@ -550,7 +534,7 @@ by Euler angles (xr, yr, zr).

obj:setTexture(tex)

This function sets the texture of obj to tex. -tex is a Lua reference to a texture loaded with +tex should be a Lua reference to a texture loaded with ag.loadTexture().

@@ -560,6 +544,7 @@ This function sets the texture of obj to tex.

This function sets the visibility of obj to visible_flag. If visible_flag is true, then the object will be drawn. +Newly created objects are visible by default.


@@ -567,5 +552,49 @@ If visible_flag is true, then the object will be drawn.

std library

+

+The std Lua library supplies a set of Lua functions that may +be useful to Lua scripts being executed. +It is not imported by default. +Import it like this: +

+ag.import("std")
+
+

+ +
+

crossProduct

+

cp = std.crossProduct(vec1, vec2)

+

+This function returns the cross product of the two vectors +vec1 and vec2. +The return value is a Lua array with indices 1 to 3. +The indices of vec1 and vec2 should be from 1 to 3. +This allows specifying a Lua array directly as a parameter to the function. +For example: +

+local z_axis = std.crossProduct({1, 0, 0}, {0, 1, 0})
+
+

+ +
+

dotProduct

+

dp = std.dotProduct(vec1, vec2)

+

+This function returns the dot product of the two vectors. +The indices of vec1 and vec2 should be from 1 to 3. +This allows specifying a Lua array directly as a parameter to the function. +

+ +
+

createPlanePointNormal

+

obj = std.createPlanePointNormal(x, y, z, nx, ny, nz)

+

+This function simply wraps +ag.createPlane() +allowing the user to specify a point on the plane with coordinates (x, y, z) +and the surface normal of the plane (nx, ny, nz). +

+