Package org.evoludo.geom
Class Node3D
Class representing a (network) node in 3D space with position and radius.
- Author:
- Christoph Hauert
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiondouble
Calculate the distance between this 3D noden
and nodem
.double
Calculate the distance squared between this 3D noden
and nodem
.double
getR()
Get the radiusr
of this 3D node.scaleR
(double scale) Scales the radius of this node byscale
.set
(double x, double y, double z, double r) Set thex
-,y
- andz
-coordinates and the radiusr
of the 3D node.Set the coordinates and radius to those of noden
.setR
(double r) Set the radiusr
of the 3D node.toString()
Methods inherited from class Point3D
distance, distance, distance2, distance2, getX, getY, getZ, scale, scale, set, set, setLocation, setLocation, setX, setY, setZ, shake, shift, shift
-
Field Details
-
r
public double rThe radiusr
of 3D node.
-
-
Constructor Details
-
Node3D
public Node3D()Create a new 3D node at(0,0,0)
with radiusr=0
. -
Node3D
Create a copy of 3D noden
.- Parameters:
n
- the node to copy
-
Node3D
public Node3D(double x, double y, double z, double r) Create a new 3D node at(x,y,z)
with radiusr
.- Parameters:
x
- thex
-coordinatey
- they
-coordinatez
- thez
-coordinater
- the radius
-
-
Method Details
-
set
Set thex
-,y
- andz
-coordinates and the radiusr
of the 3D node.- Parameters:
x
- thex
-coordinatey
- they
-coordinatez
- thez
-coordinater
- the radius- Returns:
- this node
-
set
Set the coordinates and radius to those of noden
.- Parameters:
n
- the node to copy- Returns:
- this node
-
getR
public double getR()Get the radiusr
of this 3D node.- Returns:
- the radius
-
setR
Set the radiusr
of the 3D node.- Parameters:
r
- the new radius- Returns:
- this node
-
scaleR
Description copied from interface:Node
Scales the radius of this node byscale
. -
distance2
Calculate the distance squared between this 3D noden
and nodem
. The distance is between the nodes, i.e. takes their respective radii into account|n-m|<sup>2</sup>
.- Parameters:
m
- the node to calculate distance to- Returns:
- the distance to node
m
-
distance
Calculate the distance between this 3D noden
and nodem
. The distance is between the nodes, i.e. takes their respective radii into account|n-m|<sup>2</sup>
.For computational efficiency the fairly expensive square-roots calculations should be avoided whenever possible.
- Parameters:
m
- the node to calculate distance to- Returns:
- the distance to node
m
- See Also:
-
toString
-