Packageaway3d.tools.utils
Classpublic class Grid
InheritanceGrid Inheritance Object

Class Grid snaps vertexes or meshes according to a given grid unit.Grid



Public Properties
 PropertyDefined By
  objectSpace : Boolean
Defines if the grid unit is applied in objectspace or worldspace.
Grid
  unit : Number
Defines if the grid unit.
Grid
Public Methods
 MethodDefined By
  
Grid(unit:Number = 1, objectSpace:Boolean = false)
Grid snaps vertexes according to a given grid unit
Grid
  
snapMesh(mesh:Mesh):void
Apply the grid code to a single mesh
Grid
  
snapObject(object3d:ObjectContainer3D, dovert:Boolean = false):void
Apply the grid code to a given object3D.
Grid
  
snapVertices(vertices:Vector.<Number>):Vector.<Number>
Snaps to grid a given Vector.<Number> of vertices
Grid
Property Detail
objectSpaceproperty
objectSpace:Boolean

Defines if the grid unit is applied in objectspace or worldspace. In worldspace, objects positions are affected.


Implementation
    public function get objectSpace():Boolean
    public function set objectSpace(value:Boolean):void
unitproperty 
unit:Number

Defines if the grid unit.


Implementation
    public function get unit():Number
    public function set unit(value:Number):void
Constructor Detail
Grid()Constructor
public function Grid(unit:Number = 1, objectSpace:Boolean = false)

Grid snaps vertexes according to a given grid unit

Parameters
unit:Number (default = 1) — [optional] Number. The grid unit. Default is 1.
 
objectSpace:Boolean (default = false) — [optional] Boolean. Apply only to vertexes in geometry objectspace when Object3D are considered. Default is false.
Method Detail
snapMesh()method
public function snapMesh(mesh:Mesh):void

Apply the grid code to a single mesh

Parameters

mesh:Mesh — Mesh. The mesh to snap to grid. Vertices are affected by default. Mesh position is snapped if grid.objectSpace is true;

snapObject()method 
public function snapObject(object3d:ObjectContainer3D, dovert:Boolean = false):void

Apply the grid code to a given object3D. If type ObjectContainer3D, all children Mesh vertices will be affected.

Parameters

object3d:ObjectContainer3D — Object3D. The Object3d to snap to grid.
 
dovert:Boolean (default = false) — [optional]. If the vertices must be handled or not. When false only object position is snapped to grid. Default is false.

snapVertices()method 
public function snapVertices(vertices:Vector.<Number>):Vector.<Number>

Snaps to grid a given Vector.<Number> of vertices

Parameters

vertices:Vector.<Number> — Vector.<Number>. The vertices vector

Returns
Vector.<Number>