Voxel C3D.models.Voxelextend

Models a single voxel. Methods of this class can be used to manipulate individual voxels; to manipulate multiple voxels, you'll want to use the voxel controller.

Attributes

Access attributes with .get('name')and .set('name', value).

  • color : Number/String

    The color of the voxel; can be anything accepted by the constructor to THREE.Color:

    a hexadecimal number, a CSS-style string (e.g. "rgb(250, 0,0)", "rgb(100%,0%,0%)", "#ff0000", "#f00", or even "red")

  • latticePosition : Array

    The position of the voxel on the lattice. Should be a 3-element array specifying the [x, y, z] position, where 0 <= x < lattice.width 0 <= y < lattice.height 0 <= z < lattice.depth

Methods

Call methods with.name(),.name(arguments)or just .name arguments .

  • clear ([options]) -> undefined# Backbone.Model

    Removes all attributes from the model, including the id attribute. Fires a "change" event unless silent is passed as an option.

    Parameters
    options
    Object (Optional)
  • clone ( ) -> Backbone.Model# Backbone.Model

    Returns a copy of the model.

    Return
    return
    Backbone.Model

    copy of the model

  • get (attribute) -> Mixed# Backbone.Model

    Get the current value of an attribute from the model. For example: note.get("title")

    Parameters
    attribute
    String

    Attribute to get

    Return
    return
    Mixed

    value of the attribute

  • has (attribute) -> Boolean# Backbone.Model

    Returns true if the attribute is set to a non-null or non-undefined value.

    if (note.has("title")) {
      ...
    }
    
    Parameters
    attribute
    String
    Return
    return
    Boolean

    true if the attribute is non-null or non-undefined, else false

  • move (dx, dy, dz) -> C3D.models.Voxel#

    Moves this voxel by the specified amount

    Parameters
    dx
    Number
    dy
    Number
    dz
    Number
    Return
  • moveTo (x, y, z) -> C3D.models.Voxel#

    Moves this voxel to the specified position

    Parameters
    x
    Number
    y
    Number
    z
    Number
    Return
  • set (attribute, [options]) -> undefined# Backbone.Model

    Set a hash of attributes (one or many) on the model. If any of the attributes change the model's state, a change event will be triggered on the model. Change events for specific attributes are also triggered, and you can bind to those as well, for example: change:title, and change:content. You may also pass individual keys and values.

    note.set({title: "March 20", content: "In his eyes she eclipses..."});
    
    book.set("title", "A Scandal in Bohemia");
    
    Parameters
    attribute
    String/Object

    (s)

    options
    Object (Optional)
  • unset (attribute, [options]) -> undefined# Backbone.Model

    Remove an attribute by deleting it from the internal attributes hash. Fires a "change" event unless silent is passed as an option.

    Parameters
    attribute
    String
    options
    Object (Optional)