Module rgg
Package de.grogra.mtg

Class MTGRoot

All Implemented Interfaces:
Transformation, VertexSequence.Vertex, Renderable, Manageable, PersistenceCapable, Shareable, UserFields, XObject, TurtleModifier, Map, Serializable

public class MTGRoot extends MTGNode implements Renderable
Class representing an MTG. Contents are in HashMap retrievable by keys specified in section "//MTGNode contents" of MTGKeys.java.
Since:
2012-02-01
Author:
yong
See Also:
  • Field Details

    • polygons

      protected PolygonMesh polygons
    • visibleSides

      protected int visibleSides
    • $TYPE

      public static final Node.NType $TYPE
    • dist$FIELD

      public static final Node.NType.Field dist$FIELD
    • visibleSides$FIELD

      public static final Node.NType.Field visibleSides$FIELD
  • Constructor Details

    • MTGRoot

      public MTGRoot()
  • Method Details

    • getNTypeImpl

      protected Node.NType getNTypeImpl()
      Description copied from class: Node
      This method returns the Node.NType which describes the managed fields of the class of this node. This method has to be implemented in every concrete subclass.
      Overrides:
      getNTypeImpl in class MTGNode
      Returns:
      type describing the managed fields of the class of this node
    • newInstance

      protected Node newInstance()
      Description copied from class: Node
      This method returns a new instance of the class of this node. This method has to be implemented in every concrete subclass.
      Overrides:
      newInstance in class MTGNode
      Returns:
      new instance of class of this node
    • setPolygons

      public void setPolygons(PolygonMesh mesh)
    • getPolygons

      public PolygonMesh getPolygons()
    • getObject

      public Object getObject(String key)
    • setObject

      public void setObject(String key, Object obj)
    • getData

      public MTGNodeData getData()
    • setData

      public void setData(MTGNodeData data)
    • deleteNodeList

      public void deleteNodeList()
    • refreshNodeIndices

      public void refreshNodeIndices() throws MTGError.MTGPlantFrameException
      Refreshes cached node list. At the same time reassigns id to the nodes. The plant frame computation is dependent on the cached node list and id of the nodes. This cached list is cleared from memory at the end of method plantFrame.
      Throws:
      MTGError.MTGPlantFrameException
    • removeInterScaleTopoRelations

      public void removeInterScaleTopoRelations() throws MTGError.MTGPlantFrameException
      Removes inter-scale topological relations (i.e. successor and branching edges).
      Throws:
      MTGError.MTGPlantFrameException
    • combinePriSecRotation

      public Matrix4d combinePriSecRotation(double x, double y, double z, double x2, double y2, double z2)
    • plantFrameDelete

      public void plantFrameDelete(int scale)
    • plantFrame

      public void plantFrame(int scale, double dist) throws MTGError.MTGPlantFrameException
      Computes the frame of the plant at the specified scale. For a static situation only. The frame of the plant is a collection of branches. The branch elements contain a top diameter, bottom diameter, length, positional coordinates and directional coordinates. Root nodes are nodes without topological parents, i.e. no father node with successor or branching edge to them.
      Parameters:
      scale -
      Throws:
      MTGError.MTGPlantFrameException
    • findLocalTopoRoot

      public int findLocalTopoRoot(int startv, int etype) throws MTGError.MTGPlantFrameException
      Find root(first node) of the compositional group node 'startv' belongs to.
      Parameters:
      startv -
      etype -
      Returns:
      Throws:
      MTGError.MTGPlantFrameException
    • pathLength

      public int pathLength(int father, int vertex, int edge)
    • mtgType

      public int mtgType() throws MTGError.MTGPlantFrameException
      Coordinates - Get the MTG geometric reference system type.
      Returns:
      MTG Type
      Throws:
      MTGError.MTGPlantFrameException
    • getBranchesCount

      public int getBranchesCount()
      Branches - Get number of branches.
      Returns:
      Number of branches
    • searchForElement

      public MTGBranchElement searchForElement(int nodeIndex)
      Branches - Returns branch element that corresponds to the node of the given index.
      Parameters:
      nodeIndex -
      Returns:
      MTGBranchElement
    • getBranches

      public ArrayList<MTGBranch> getBranches()
      Branches - Get the branches or plant frame.
      Returns:
      List of branches.
    • incrementPlantCount

      public void incrementPlantCount() throws MTGError.MTGPlantFrameException
      Plant - Increment the counter for the number of plants specified in this MTG.
      Throws:
      MTGError.MTGPlantFrameException
    • getPlantCount

      public int getPlantCount() throws MTGError.MTGPlantFrameException
      Plant - Gets the number of plants recognized in this MTG so far.
      Returns:
      Number of plants recognized in this MTG so far.
      Throws:
      MTGError.MTGPlantFrameException
    • height

      public int height(MTGNode startNode, MTGNode endNode) throws MTGError.MTGPlantFrameException
      Number of successor or branch edges from a start node to an end node.
      Parameters:
      startNodeId -
      endNodeId -
      Returns:
      Throws:
      MTGError.MTGPlantFrameException
    • getRoots

      public MTGNode[] getRoots(int scale) throws MTGError.MTGPlantFrameException
      Throws:
      MTGError.MTGPlantFrameException
    • getRootIds

      public int[] getRootIds(int scale) throws MTGError.MTGPlantFrameException
      Obtain a list of indices of root nodes refined the specified node.
      Parameters:
      scale -
      Returns:
      List if indices of root nodes.
      Throws:
      MTGError.MTGPlantFrameException
    • getClassesInfo

      Classes - Returns information of MTG classes defined.
      Returns:
      List of class information
      Throws:
      MTGError.MTGPlantFrameException
    • getFeaturesInfo

      Features - Returns information of MTG features defined.
      Returns:
      List of feature information.
      Throws:
      MTGError.MTGPlantFrameException
    • getNode

      public MTGNode getNode(int nodeIndex)
      Nodes - Returns MTGNode instance given its index.
      Parameters:
      nodeIndex -
      Returns:
      MTGNode at specified index
    • getIndex

      public int getIndex(MTGNode node)
      Nodes - Returns index of MTGNode given its instance.
      Parameters:
      node -
      Returns:
      index of node.
    • edgeType

      public int edgeType(int sourceIndex, int targetIndex)
      Nodes - Get the edge bits (int) between a source node and a target node.
      Parameters:
      sourceIndex -
      targetIndex -
      Returns:
      edge type
    • topoFather

      public int topoFather(int nodeIndex, int edgeType)
      Nodes - Returns index of node that is topological father of node specified by input nodeIndex.
      Parameters:
      nodeIndex -
      edgeType -
      Returns:
      index of topological father node
    • topoSons

      public int[] topoSons(int nodeIndex, int edgeType)
      Nodes - For usage by root MTG node. To find the topological sons of the node found in list of nodes at specified nodeIndex.
      Parameters:
      nodeIndex -
      edgeType -
      Returns:
      indices of topological son nodes.
    • compoFather

      public int compoFather(int nodeIndex)
      Nodes - Returns refinement father of the specified node.
      Parameters:
      nodeIndex -
      Returns:
      index of refinement father node.
    • compoFather

      public MTGNode compoFather(MTGNode node)
      Nodes - Returns refinement father of the specified node.
      Parameters:
      nodeIndex -
      Returns:
      index of refinement father node.
    • compoSonsIds

      public int[] compoSonsIds(int nodeIndex, int scale) throws MTGError.MTGPlantFrameException
      Returns compositional sons of a node, given that the compositional sons are of a lower scale than the given scale.
      Parameters:
      nodeIndex -
      scale -
      Returns:
      Throws:
      MTGError.MTGPlantFrameException
    • compoSonsIds

      public int[] compoSonsIds(int nodeIndex)
      Nodes - Returns refinement sons of the specified node.
      Parameters:
      nodeIndex -
      Returns:
      indices of refinement son nodes.
    • getScale

      public int getScale(int nodeIndex) throws MTGError.MTGPlantFrameException
      Nodes - Returns scale of node at index specified.
      Parameters:
      nodeIndex -
      Returns:
      Scale of node.
      Throws:
      MTGError.MTGPlantFrameException
    • classSymbolToClassIndex

      public int classSymbolToClassIndex(String classSymbol)
    • classScale

      public int classScale(String classSymbol)
      Returns scale of a given class
      Parameters:
      classSymbol -
      Returns:
    • classSymbolsToClassIndices

      public int[] classSymbolsToClassIndices(String[] classSymbols)
    • draw

      public void draw(Object object, boolean asNode, RenderState rs)
      Specified by:
      draw in interface Renderable
    • setElevationAzimuth

      public void setElevationAzimuth(Vector3d vec, double ele, double azi)
    • changeBenchmark

      public void changeBenchmark(Vector3d ori, Vector3d u, Vector3d v, Vector3d w)