Red3D:
Filter:
redUniverse/Classes (extension) | Red > redUniverse > shapes

Red3D
ExtensionExtension

abstract 3D class

Description

An abstract class for 3D shape classes.

Instance Methods

.points

An array of RedVector3D defining the corners of the shape.

.outlines

An array of arrays with pairs of indices defining connections between the points (corners) of the shape.

.surfaces

An array or arrays with four indices defining the planes (rectangles) of the shape.

.position

Get or set the current position of the shape as a RedVector3D.

.rotation

Get or set the current rotation of the shape.

Arguments:

redVec

A RedVector3D.

.rotationX

Set the angle of rotation around the X axis.

Arguments:

theta

In radians.

.rotationY

Set the angle of rotation around the Y axis.

Arguments:

theta

In radians.

.rotationZ

Set the angle of rotation around the Z axis.

Arguments:

theta

In radians.

.rotationMatrices

Returns an array of 3 arrays each holding a 3-row matrix for the current rotation in X, Y and Z dimensions. This is calculated when calling -update.

.vectors

An array of RedVector3D. This holds the current positions of all points (corners) after rotation. This is calculated when calling -update.

.renderedPoints

An array of Points. This holds the current positions of all points (corners) after projection and scaling. This is calculated when calling -render.

Arguments:

dist

Distance. A value lower than 2 exaggerate the depth.

size

Scaling factor.

.update

Call this to perform the rotation calculations. This updates the variable -vectors.

.render

Call this to perform the projection and scaling calculations. This updates the variable -rederedPoints.

.draw

Draws an oval at each point (in each corner). Must be called inside a draw function. Use Pen.fillColor_ to set the color.

Arguments:

dotSize

The size of the oval.

.drawOutlines

Draws a line between each point (all edges). Must be called inside a draw function. Use Pen.strokeColor_ to set the color, and Pen.width_ to set the line thickness.

.drawSurfaces

Draws a rectangle for each plane. Must be called inside a draw function. Use Pen.fillColor_ to set the color.

Examples