The X Toolkit API

X.cube

/**
* Create a displayable cube.
*
* @constructor
* @extends X.object
* @mixin X.constructable
*/
var c = new X.cube();
/**
* The caption of this object.
*
* @type {?string}
* @protected
*/
c._caption = $_CAPTION;
/**
* The center of this cube in the world space.
*
* @type {!Array}
* @protected
*/
c._center = $_CENTER;
/**
* The children of this object.
*
* @type {!Array}
* @protected
*/
c._children = $_CHILDREN;
/**
* The className of this class.
*
* @type {string}
* @protected
*/
c._classname = $_CLASSNAME;
/**
* The object color. By default, this is white.
*
* @type {!Array}
* @public
*/
c._color = $_COLOR;
/**
* The point colors of this object.
*
* @type {?X.triplets}
* @protected
*/
c._colors = $_COLORS;
/**
* The color table of this object.
*
* @type {?X.colortable}
* @protected
*/
c._colortable = $_COLORTABLE;
/**
* The 'dirty' flag of this object.
*
* @type {boolean}
* @protected
*/
c._dirty = $_DIRTY;
/**
* This distance of this object to the viewer's eye.
*
* @type {number}
* @protected
*/
c._distance = $_DISTANCE;
/**
* The uniqueId of this instance. Each class instance in XTK has a uniqueId.
*
* @type {number}
* @protected
*/
c._id = $_ID;
/**
* The edge length in X-direction.
*
* @type {!number}
* @protected
*/
c._lengthX = $_LENGTHX;
/**
* The edge length in Y-direction.
*
* @type {!number}
* @protected
*/
c._lengthY = $_LENGTHY;
/**
* The edge length in Z-direction.
*
* @type {!number}
* @protected
*/
c._lengthZ = $_LENGTHZ;
/**
* The line width, only used in X.displayable.types.LINES mode.
*
* @type {number}
* @protected
*/
c._linewidth = $_LINEWIDTH;
/**
* The flag for the magic mode.
*
* @type {!boolean}
* @protected
*/
c._magicmode = $_MAGICMODE;
/**
* The normals of this object.
*
* @type {?X.triplets}
* @protected
*/
c._normals = $_NORMALS;
/**
* The opacity of this object.
*
* @type {number}
* @protected
*/
c._opacity = $_OPACITY;
/**
* An array reflecting the point or vertex indices.
*
* @type {!Array}
* @protected
*/
c._pointIndices = $_POINTINDICES;
/**
* The points of this object.
*
* @type {?X.triplets}
* @protected
*/
c._points = $_POINTS;
/**
* The point size, only used in X.displayable.types.POINTS mode.
*
* @type {number}
* @protected
*/
c._pointsize = $_POINTSIZE;
/**
* The scalars of this object.
*
* @type {?X.scalars}
* @protected
*/
c._scalars = $_SCALARS;
/**
* The texture of this object.
*
* @type {?X.texture}
* @protected
*/
c._texture = $_TEXTURE;
/**
* The mapping between object and texture coordinates.
*
* @type {?Array}
* @protected
*/
c._textureCoordinateMap = $_TEXTURECOORDINATEMAP;
/**
* The transform of this object.
*
* @type {!X.transform}
* @protected
*/
c._transform = $_TRANSFORM;
/**
* The rendering type of this object, default is
* {X.displayable.types.TRIANGLES}.
*
* @type {X.displayable.types}
* @protected
*/
c._type = $_TYPE;
/**
* The visibility of this object.
*
* @type {boolean}
* @public
*/
c._visible = $_VISIBLE;
/**
* Get the caption of this object.
*
* @return {?string} The caption of this object.
* @public
*/
var _caption = c.caption;
/**
* Set the caption for this object.
*
* @param {?string} caption The caption for this object.
* @public
*/
c.caption = $CAPTION;
/**
* Get the center of this cube.
*
* @return {!Array} The center as an array with length 3.
* @public
*/
var _center = c.center;
/**
* Set the center of this cube.
*
* @param {!Array} center The center as an array with length 3 ([X,Y,Z]).
* @throws {Error} An error, if the center is invalid.
* @public
*/
c.center = $CENTER;
/**
* Get the children of this object. Each object can have N children which get
* automatically rendered when the top level object gets rendered.
*
* @return {!Array} The children of this object which are again objects.
*/
var _children = c.children;
/**
* Get the className of this object.
*
* @return {string} The className of this object.
* @public
*/
var _classname = c.classname;
/**
* Get the object color.
*
* @return {!Array} The object color.
*/
var _color = c.color;
/**
* Set the object color. This overrides any point colors.
*
* @param {!Array} color The object color as an array with length 3 and values
*          between 0..1.
* @throws {Error} An exception if the given color is invalid.
*/
c.color = $COLOR;
/**
* Get the point colors of this object.
*
* @return {!X.triplets} The point colors.
*/
var _colors = c.colors;
/**
* Set the colors of this object.
*
* @param {!X.triplets} colors The colors.
*/
c.colors = $COLORS;
/**
* The color table associated with this object.
*
* @return {?X.colortable} The color table.
*/
var _colortable = c.colortable;
/**
* Get the id of this instance.
*
* @return {string} The className of this object.
* @public
*/
var _id = c.id;
/**
* Get the edge length in X-direction.
*
* @return {!number} The edge length in X-direction.
* @public
*/
var _lengthX = c.lengthX;
/**
* Set the edge length in X-direction.
*
* @param {!number} lengthX The edge length in X-direction.
* @throws {Error} An error, if the given length is invalid.
* @public
*/
c.lengthX = $LENGTHX;
/**
* Get the edge length in Y-direction.
*
* @return {!number} The edge length in Y-direction.
* @public
*/
var _lengthY = c.lengthY;
/**
* Set the edge length in Y-direction.
*
* @param {!number} lengthY The edge length in Y-direction.
* @throws {Error} An error, if the given length is invalid.
* @public
*/
c.lengthY = $LENGTHY;
/**
* Get the edge length in Z-direction.
*
* @return {!number} The edge length in Z-direction.
* @public
*/
var _lengthZ = c.lengthZ;
/**
* Set the edge length in Z-direction.
*
* @param {!number} lengthZ The edge length in Z-direction.
* @throws {Error} An error, if the given length is invalid.
* @public
*/
c.lengthZ = $LENGTHZ;
/**
* Get the line width of this object. The line width is only used in
* X.displayable.types.LINES rendering mode.
*
* @return {!number} The line width.
*/
var _linewidth = c.linewidth;
/**
* Set the line width for this object. The line width is only used in
* X.displayable.types.LINES rendering mode.
*
* @param {!number} width The line width.
* @throws {Error} An exception if the given width is invalid.
*/
c.linewidth = $WIDTH;
/**
* Get the magic mode flag.
*
* @return {!boolean} The magic mode flag.
*/
var _magicmode = c.magicmode;
/**
* Set the magic mode flag.
*
* @param {!boolean} magicmode The magic mode flag.
*/
c.magicmode = $MAGICMODE;
/**
* Get the normals of this object.
*
* @return {!X.triplets} The normals.
*/
var _normals = c.normals;
/**
* Set the normals of this object.
*
* @param {!X.triplets} normals The normals.
*/
c.normals = $NORMALS;
/**
* Get the opacity of this object. If the object is fully opaque, this returns
* 1.
*
* @return {number} The opacity in the range 0..1.
*/
var _opacity = c.opacity;
/**
* Set the opacity of this object.
*
* @param {number} opacity The opacity value in the range 0..1.
*/
c.opacity = $OPACITY;
/**
* Get the points of this object.
*
* @return {!X.triplets} The points.
*/
var _points = c.points;
/**
* Set the points of this object.
*
* @param {!X.triplets} points The points.
*/
c.points = $POINTS;
/**
* Get the point size of this object. The point size is only used in
* X.displayable.types.POINTS rendering mode.
*
* @return {!number} The point size.
*/
var _pointsize = c.pointsize;
/**
* Set the point size for this object. The point size is only used in
* X.displayable.types.POINTS rendering mode.
*
* @param {!number} size The point size.
* @throws {Error} An exception if the given size is invalid.
*/
c.pointsize = $SIZE;
/**
* The scalars associated with this object.
*
* @return {?X.scalars} The scalars.
*/
var _scalars = c.scalars;
/**
* Get the texture of this object.
*
* @return {!X.texture} The texture.
*/
var _texture = c.texture;
/**
* Get the transform of this object.
*
* @return {!X.transform} The transform.
*/
var _transform = c.transform;
/**
* Get the render type of this object.
*
* @return {!string} The render type.
*/
var _type = c.type;
/**
* Set the render type of this object. Valid types are: TRIANGLES,
* TRIANGLE_STRIPS, LINES, POINTS, POLYGONS
*
* @param {!string} type The render type.
*/
c.type = $TYPE;
/**
* Get the visibility of this object.
*
* @return {boolean} TRUE if the object is visible, FALSE otherwise.
* @public
*/
var _visible = c.visible;
/**
* Set the visibility of this object.
*
* @param {boolean} visible The object's new visibility.
* @public
*/
c.visible = $VISIBLE;
/**
* Copies the properties from a given object to this object. The texture,
* textureCoordinateMap and the children are not copied but linked.
*
* @param {*} object The given object.
* @protected
*/
c.copy_($OBJECT);
/**
* Convert a CSG object to this X.object.
*
* @param {!CSG} csg The CSG object.
* @throws {Error} An error if the given object is invalid.
*/
c.fromCSG($CSG);
/**
* Intersect an X.object or a CSG object with this X.object and return a new
* X.object.
*
* @param {!CSG|X.object} object The object to use for the intersect operation.
* @return {X.object} A new X.object.
* @throws {Error} An error if the given object is invalid.
* @suppress {missingProperties}
*/
var intersect = c.intersect($OBJECT);
/**
* Inverse this X.object and return a new X.object.
*
* @return {X.object} A new X.object.
* @suppress {missingProperties}
*/
var inverse = c.inverse();
/**
* Fire a modified event for this object.
*
* @param {?boolean=} propagateEvent An optional flag to stop propagating down to child classes.
*/
c.modified($PROPAGATEEVENT);
/**
* Subtract an X.object or a CSG object from this X.object and return a new
* X.object.
*
* @param {!CSG|X.object} object The object to subtract.
* @return {X.object} A new X.object.
* @throws {Error} An error if the given object is invalid.
* @suppress {missingProperties}
*/
var subtract = c.subtract($OBJECT);
/**
* Convert this X.object to a CSG object.
*
* @return {!CSG} The created CSG object.
*/
var toCSG = c.toCSG();
/**
* Union this X.object with either another X.object or a CSG object and return a
* new X.object.
*
* @param {!CSG|X.object} object The other X.object or CSG object.
* @return {X.object} A new X.object.
* @throws {Error} An error if the given object is invalid.
* @suppress {missingProperties}
*/
var union = c.union($OBJECT);
/**
* Compare two X.objects by their opacity values and their distance to the
* viewer's eye. Fully opaque objects should be always ordered before
* transparent ones, and the transparent ones should be ordered back-to-front in
* terms of the distance to the viewer's eye.
*
* @param {X.object} object1 Object1 to compare against Object2.
* @param {X.object} object2 Object2 to compare against Object1.
* @return {!number} 1, if Object1 should be ordered after Object2. -1, if
*         Object1 should be ordered before Object2
*/
var OPACITY_COMPARATOR = X.cube.OPACITY_COMPARATOR($OBJECT1, $OBJECT2);
/**
* Different render types for any displayable objects.
*
* @enum {string}
*/
X.cube.types();


CONSTRUCTORS
X.cube

PROPERTIES
_caption
_center
_children
_classname
_color
_colors
_colortable
_dirty
_distance
_id
_lengthX
_lengthY
_lengthZ
_linewidth
_magicmode
_normals
_opacity
_pointIndices
_points
_pointsize
_scalars
_texture
_textureCoordinateMap
_transform
_type
_visible

GETTERS/SETTERS
caption
center
children
classname
color
colors
colortable
id
lengthX
lengthY
lengthZ
linewidth
magicmode
normals
opacity
points
pointsize
scalars
texture
transform
type
visible

FUNCTIONS
copy_
fromCSG
intersect
inverse
modified
subtract
toCSG
union

STATIC
OPACITY_COMPARATOR
types



SOURCECODE