net.sourceforge.arbaro.tree
Class Segment

java.lang.Object
  extended bynet.sourceforge.arbaro.tree.Segment

public class Segment
extends java.lang.Object

A segment class, multiple segments form a stem.

Author:
Wolfram Diestel

Field Summary
 int index
           
 LevelParams lpar
           
 double rad2
           
 java.util.Vector subsegments
           
 
Constructor Summary
Segment(Stem stm, int inx, Transformation trf, double r1, double r2)
           
 
Method Summary
 double getLength()
           
 boolean isFirstStemSegment()
          Tests, if the segment is the first stem segment
 boolean isLastStemSegment()
          Tests, if the segment ist the last stem segment
 void make()
          Makes the segments from subsegments
 Vector posFrom()
          Position at the beginning of the segment
 Vector posTo()
          Position of the end of the segment
 Transformation substemPosition(Transformation trf, double where)
          Calcs the position of a substem in the segment given a relativ position where in 0..1 - needed esp. for helical stems, because the substems doesn't grow from the axis of the segement
 boolean traverseStem(StemTraversal traversal)
          Adds the segments to a mesh part.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

lpar

public LevelParams lpar

index

public int index

rad2

public double rad2

subsegments

public java.util.Vector subsegments
Constructor Detail

Segment

public Segment(Stem stm,
               int inx,
               Transformation trf,
               double r1,
               double r2)
Method Detail

getLength

public double getLength()

make

public void make()
Makes the segments from subsegments


substemPosition

public Transformation substemPosition(Transformation trf,
                                      double where)
Calcs the position of a substem in the segment given a relativ position where in 0..1 - needed esp. for helical stems, because the substems doesn't grow from the axis of the segement

Parameters:
trf - the transformation of the substem
where - the offset, where the substem spreads out
Returns:
the new transformation of the substem (shifted from the axis of the segment to the axis of the subsegment)

posFrom

public Vector posFrom()
Position at the beginning of the segment

Returns:
beginning point of the segment

posTo

public Vector posTo()
Position of the end of the segment

Returns:
end point of the segment

isFirstStemSegment

public boolean isFirstStemSegment()
Tests, if the segment is the first stem segment

Returns:
true, if it's the first stem segment, false otherwise

isLastStemSegment

public boolean isLastStemSegment()
Tests, if the segment ist the last stem segment

Returns:
true, if it's the last stem segment, false otherwise

traverseStem

public boolean traverseStem(StemTraversal traversal)
                     throws TraversalException
Adds the segments to a mesh part. For every subsegment one ore two mesh sections are added.

Throws:
TraversalException