Voxel Controller C3D.ctrls.Voxelsextend

Tracks and manages voxels.

Properties

Access properties with .nameand .name = value.

  • canvas : C3D.Canvas3D

    Reference to the canvas to which this controller belongs

Methods

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

  • addAt (a, b, c) -> C3D.models.Voxel#

    Adds a voxel at the passed lattice position

    Parameters
    a
    Number
    b
    Number
    c
    Number
    Return
  • addBy (fun) -> C3D.models.Voxel#

    Adds voxels according to an arbitrary predicate function

    Parameters
    fun
    Function

    Predicate to apply to each position in the lattice.

    Return
  • 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

  • each (iterator, i, j, k, voxel) -> undefined#

    Applies an iterator to each voxel in the canvas

    Parameters
    iterator
    Function

    Function to be called on each voxel

    i
    Number
    j
    Number
    k
    Number
    voxel
    C3D.models.Voxel
  • find (a, b, c) -> C3D.models.Voxel#

    Finds a voxel at the passed lattice position

    Parameters
    a
    Number
    b
    Number
    c
    Number
    Return
  • 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

  • getExtents ( ) -> Number[][]#

    Determines the bounding box (extents) of the current set of voxels, that is, the minimum and maximum value on each axis

    Return
    return
    Number[][]

    extents:

    [ [xmin, xmax], [ymin, ymax], [zmin, zmax] ]
    
  • 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

  • image ( ) -> ndarray#

    Returns a 3D binary image of the voxels in the lattice

    Return
    return
    ndarray

    Image

  • query (fun, [output]) -> ndarray#

    Applies a query to each position in the lattice, saving the result in an ndarray.

    Parameters
    fun
    Function
    output
    ndarray

    Existing array to which to write the output; if omitted, one will be created

    (Optional; defaults to null)
    Return
    return
    ndarray

    Result

  • removeAt (a, b, c) -> C3D.models.Voxel#

    Deletes a voxel at the passed lattice position

    Parameters
    a
    Number
    b
    Number
    c
    Number
    Return
  • removeBy (fun) -> undefined#

    Removes voxels according to an arbitrary predicate function (like addBy)

    Parameters
    fun
    Object
  • selectTransform (select, transform) -> undefined#

    Select voxels according to an arbitrary predicate, then transform them using an arbitrary transformation function.

    Parameters
    select
    Function

    Selection predicate function

    transform
    Function

    Transformation function

  • 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)
  • setBy (fun) -> undefined#

    Sets voxels according to an arbitrary predicate function (like addBy); if the predicate returns true, then a voxel is added (if there's no voxel at that position); if it returns false and there's a voxel there, it's removed.

    Parameters
    fun
    Object
  • 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)