mpicbg.models
Class Vertex

java.lang.Object
  extended by mpicbg.models.Point
      extended by mpicbg.models.Vertex
All Implemented Interfaces:
Serializable

public class Vertex
extends Point

An n-dimensional Vertex being connected to other Vertices by Springs

Author:
Stephan Saalfeld
See Also:
Serialized Form

Field Summary
protected  double[] direction
          The current moving direction of the Vertex.
protected  double[] force
          The resulting force amplitude applied to this Vertex.
protected  double forceAmplitude
           
protected  double speed
           
protected  HashMap<Vertex,Spring> springs
          A set of Springs with v1 being this Vertex and v2 being the Vertex at the other side of the Spring.
 
Fields inherited from class mpicbg.models.Point
l, w
 
Constructor Summary
Vertex(double[] l)
          Constructor
Vertex(double[] l, double[] w)
          Constructor
Vertex(Point point)
          Constructor The Vertex takes over the coordinates of the Point by pointer.
 
Method Summary
 void addSpring(Vertex v2, double weight)
          Add a Spring connecting this Vertex with another Vertex.
 void addSpring(Vertex v2, double[] weights)
          Add a Spring connecting this Vertex with another Vertex.
 void addSpring(Vertex v2, double[] weights, double maxStretch)
          Add a Spring connecting this Vertex with another Vertex.
 void addSpring(Vertex v2, double weight, double maxStretch)
          Add a Spring connecting this Vertex with another Vertex.
 void addSpring(Vertex v2, Spring spring)
          Add a Spring connecting this Vertex with another Vertex.
 Set<Vertex> getConnectedVertices()
          Get all Vertices that are connected to this Vertex by a spring.
 double[] getDirection()
           
 double getForce()
           
 double[] getForces()
           
 double getForceSum()
           
 double getSpeed()
           
 Spring getSpring(Vertex vertex)
          Get the Spring that connects this Vertex to a given other Vertex if any.
 Collection<Spring> getSprings()
           
 void move(double t)
          Move the vertex for a given time.
 int traceConnectedGraph(Set<Vertex> graph)
          Find all Vertices that represent one connectivity graph by recursively tracing the springs.
 void update(double damp)
          Deprecated. Remains for legacy compatibility
 void update(double damp, double dt)
          Calculate the current force, direction and speed.
 void updateDirection(double dampDt, double dt)
          Calculate the current direction and speed.
 void updateForce()
          Calculate the current force.
 
Methods inherited from class mpicbg.models.Point
apply, apply, apply, applyInverse, applyInverse, clone, distance, distance, getL, getW, localDistance, squareDistance, squareDistance, squareLocalDistance
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

springs

protected final HashMap<Vertex,Spring> springs
A set of Springs with v1 being this Vertex and v2 being the Vertex at the other side of the Spring.


direction

protected final double[] direction
The current moving direction of the Vertex. The length of this vector gives the current speed.


speed

protected double speed

force

protected final double[] force
The resulting force amplitude applied to this Vertex.


forceAmplitude

protected double forceAmplitude
Constructor Detail

Vertex

public Vertex(double[] l)
Constructor

Parameters:
l - local coordinates

Vertex

public Vertex(double[] l,
              double[] w)
Constructor

Parameters:
l - local coordinates
w - world coordinates

Vertex

public Vertex(Point point)
Constructor The Vertex takes over the coordinates of the Point by pointer. That is, changes applied to the Vertex will affect the Point and vice versa. TODO This is done for use in SpringMesh that replaces control points by the Vertex class. It feels that there is a better solution for this problem...

Parameters:
location -
Method Detail

getSprings

public Collection<Spring> getSprings()

getConnectedVertices

public Set<Vertex> getConnectedVertices()
Get all Vertices that are connected to this Vertex by a spring.

Returns:
conntected vertices

getSpring

public Spring getSpring(Vertex vertex)
Get the Spring that connects this Vertex to a given other Vertex if any.

Parameters:
vertex -
Returns:

addSpring

public void addSpring(Vertex v2,
                      Spring spring)
Add a Spring connecting this Vertex with another Vertex. It puts the spring to the other Vertex as well.

Parameters:
v2 - the other Vertex
spring - the Spring

addSpring

public void addSpring(Vertex v2,
                      double[] weights)
Add a Spring connecting this Vertex with another Vertex. It puts the spring to the other Vertex as well.

Parameters:
v2 - the other Vertex
weights - weighting factors

addSpring

public void addSpring(Vertex v2,
                      double[] weights,
                      double maxStretch)
Add a Spring connecting this Vertex with another Vertex. It puts the spring to the other Vertex as well.

Parameters:
v2 - the other Vertex
weights - weighting factors
maxStretch - stretch limit

addSpring

public void addSpring(Vertex v2,
                      double weight)
Add a Spring connecting this Vertex with another Vertex. It puts the spring to the other Vertex as well.

Parameters:
v2 - the other Vertex
weight - weighting factor (spring constant)

addSpring

public void addSpring(Vertex v2,
                      double weight,
                      double maxStretch)
Add a Spring connecting this Vertex with another Vertex. It puts the spring to the other Vertex as well.

Parameters:
v2 - the other Vertex
weight - weighting factor (spring constant)
maxStretch - stretch limit

getDirection

public double[] getDirection()

getSpeed

public double getSpeed()

getForceSum

public double getForceSum()

getForces

public double[] getForces()

getForce

public double getForce()

updateForce

public void updateForce()
Calculate the current force.


updateDirection

public void updateDirection(double dampDt,
                            double dt)
Calculate the current direction and speed.

Parameters:
dampDt - damping factor (0.0 fully damped, 1.0 not damped) to the power of dt dampDt = Math.pow( damp, dt )
dt - time delta

update

public void update(double damp,
                   double dt)
Calculate the current force, direction and speed.

Parameters:
damp - damping factor (0.0 fully damped, 1.0 not damped)

update

@Deprecated
public void update(double damp)
Deprecated. Remains for legacy compatibility

Calculate the current force, direction and speed.

Parameters:
damp - damping factor (0.0 fully damped, 1.0 not damped)

move

public final void move(double t)
Move the vertex for a given time.

Parameters:
t - time

traceConnectedGraph

public final int traceConnectedGraph(Set<Vertex> graph)
Find all Vertices that represent one connectivity graph by recursively tracing the springs.

Parameters:
graph -
Returns:
the number of connected tiles in the graph


Copyright © 2007-2016 Fiji. All Rights Reserved.