public class Vertex extends Point
Modifier and Type | Field and Description |
---|---|
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 . |
Constructor and Description |
---|
Vertex(double[] l)
Constructor
|
Vertex(double[] l,
double[] w)
Constructor
|
Vertex(Point point)
|
Modifier and Type | Method and Description |
---|---|
void |
addSpring(Vertex v2,
double weight)
|
void |
addSpring(Vertex v2,
double[] weights)
|
void |
addSpring(Vertex v2,
double[] weights,
double maxStretch)
|
void |
addSpring(Vertex v2,
double weight,
double maxStretch)
|
void |
addSpring(Vertex v2,
Spring spring)
|
Set<Vertex> |
getConnectedVertices()
|
double[] |
getDirection() |
double |
getForce() |
double[] |
getForces() |
double |
getForceSum() |
double |
getSpeed() |
Spring |
getSpring(Vertex vertex)
|
Collection<Spring> |
getSprings() |
void |
move(double t)
Move the vertex for a given time.
|
int |
traceConnectedGraph(Set<Vertex> graph)
|
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.
|
apply, apply, apply, applyInverse, applyInverse, clone, distance, distance, getL, getW, localDistance, squareDistance, squareDistance, squareLocalDistance
protected final double[] direction
Vertex
. The length of this
vector gives the current speed.protected double speed
protected final double[] force
Vertex
.protected double forceAmplitude
public Vertex(double[] l)
l
- local coordinatespublic Vertex(double[] l, double[] w)
l
- local coordinatesw
- world coordinatespublic Vertex(Point point)
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...point
- public Collection<Spring> getSprings()
public void addSpring(Vertex v2, double[] weights)
Spring
connecting this Vertex
with another
Vertex
. It puts the spring to the other Vertex
as well.v2
- the other Vertex
weights
- weighting factorspublic void addSpring(Vertex v2, double[] weights, double maxStretch)
Spring
connecting this Vertex
with another
Vertex
. It puts the spring to the other Vertex
as well.v2
- the other Vertex
weights
- weighting factorsmaxStretch
- stretch limitpublic void addSpring(Vertex v2, double weight)
Spring
connecting this Vertex
with another
Vertex
. It puts the spring to the other Vertex
as well.v2
- the other Vertex
weight
- weighting factor (spring constant)public void addSpring(Vertex v2, double weight, double maxStretch)
Spring
connecting this Vertex
with another
Vertex
. It puts the spring to the other Vertex
as well.v2
- the other Vertex
weight
- weighting factor (spring constant)maxStretch
- stretch limitpublic double[] getDirection()
public double getSpeed()
public double getForceSum()
public double[] getForces()
public double getForce()
public void updateForce()
public void updateDirection(double dampDt, double dt)
dampDt
- damping factor (0.0 fully damped, 1.0 not damped) to the power of dt
dampDt = Math.pow( damp, dt )dt
- time deltapublic void update(double damp, double dt)
damp
- damping factor (0.0 fully damped, 1.0 not damped)@Deprecated public void update(double damp)
damp
- damping factor (0.0 fully damped, 1.0 not damped)public final void move(double t)
t
- timeCopyright © 2015–2021 Fiji. All rights reserved.