public class GraphPosLengthUtils
extends java.lang.Object
Use this class with a static import.
Constructor and Description |
---|
GraphPosLengthUtils() |
Modifier and Type | Method and Description |
---|---|
static double |
edgeLength(Edge edge)
Like
edgeLength(Graph,String) but use an existing edge as argument. |
static double |
edgeLength(Graph graph,
java.lang.String id)
Compute the edge length of the given edge according to its two nodes
positions.
|
static Point3 |
nodePointPosition(Graph graph,
java.lang.String id)
Retrieve a node position from its attributes ("x", "y", "z", or "xy", or
"xyz").
|
static Point3 |
nodePointPosition(Node node)
Like
nodePointPosition(Graph,String) but use an existing node as
argument. |
static double[] |
nodePosition(Graph graph,
java.lang.String id)
Retrieve a node position from its attributes ("x", "y", "z", or "xy", or
"xyz").
|
static void |
nodePosition(Graph graph,
java.lang.String id,
double[] xyz)
Like
nodePosition(Graph,String) , but instead of returning a newly
allocated array, fill up the array given as parameter. |
static Point3 |
nodePosition(Graph graph,
java.lang.String id,
Point3 pos)
Like
nodePointPosition(Graph,String) , but instead of returning a
newly allocated array, fill up the array given as parameter. |
static double[] |
nodePosition(Node node)
Like
nodePosition(Graph,String) but use an existing node as
argument. |
static void |
nodePosition(Node node,
double[] xyz)
Like
nodePosition(Graph,String,double[]) but use an existing node as
argument. |
static Point3 |
nodePosition(Node node,
Point3 pos)
Like
nodePosition(Graph,String,Point3) but use an existing node as
argument. |
static void |
positionFromObject(java.lang.Object o,
double[] xyz)
Try to convert an object to a position.
|
static Point3 |
positionFromObject(java.lang.Object o,
Point3 pos)
Try to convert an object to a position.
|
public static double[] nodePosition(Graph graph, java.lang.String id)
id
- The node identifier.public static Point3 nodePointPosition(Graph graph, java.lang.String id)
id
- The node identifier.public static double[] nodePosition(Node node)
nodePosition(Graph,String)
but use an existing node as
argument.node
- The node to consider.public static Point3 nodePointPosition(Node node)
nodePointPosition(Graph,String)
but use an existing node as
argument.node
- The node to consider.public static void nodePosition(Graph graph, java.lang.String id, double[] xyz)
nodePosition(Graph,String)
, but instead of returning a newly
allocated array, fill up the array given as parameter. This array must have
at least three cells.id
- The node identifier.xyz
- An array of at least three cells.java.lang.RuntimeException
- If the node with the given identifier does not exist.public static Point3 nodePosition(Graph graph, java.lang.String id, Point3 pos)
nodePointPosition(Graph,String)
, but instead of returning a
newly allocated array, fill up the array given as parameter. This array must
have at least three cells.id
- The node identifier.pos
- A point that will receive the node position.java.lang.RuntimeException
- If the node with the given identifier does not exist.public static void nodePosition(Node node, double[] xyz)
nodePosition(Graph,String,double[])
but use an existing node as
argument.node
- The node to consider.xyz
- An array of at least three cells.public static Point3 nodePosition(Node node, Point3 pos)
nodePosition(Graph,String,Point3)
but use an existing node as
argument.node
- The node to consider.pos
- A point that will serve as the default position if node doesn't
have positionpublic static void positionFromObject(java.lang.Object o, double[] xyz)
o
- The object to try to convert.xyz
- The result.public static Point3 positionFromObject(java.lang.Object o, Point3 pos)
o
- The object to try to convert.pos
- The default position if object doesn't have position data.public static double edgeLength(Graph graph, java.lang.String id)
id
- The identifier of the edge.java.lang.RuntimeException
- If the edge cannot be found.public static double edgeLength(Edge edge)
edgeLength(Graph,String)
but use an existing edge as argument.edge
-