Class Node3D

Object
Point3D
Node3D
All Implemented Interfaces:
Node, Point

public class Node3D extends Point3D implements Node
Class representing a (network) node in 3D space with position and radius.
Author:
Christoph Hauert
  • Field Details

    • r

      public double r
      The radius r of 3D node.
  • Constructor Details

    • Node3D

      public Node3D()
      Create a new 3D node at (0,0,0) with radius r=0.
    • Node3D

      public Node3D(Node3D n)
      Create a copy of 3D node n.
      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 radius r.
      Parameters:
      x - the x-coordinate
      y - the y-coordinate
      z - the z-coordinate
      r - the radius
  • Method Details

    • set

      public Node3D set(double x, double y, double z, double r)
      Set the x-, y- and z-coordinates and the radius r of the 3D node.
      Parameters:
      x - the x-coordinate
      y - the y-coordinate
      z - the z-coordinate
      r - the radius
      Returns:
      this node
    • set

      public Node3D set(Node3D n)
      Set the coordinates and radius to those of node n.
      Parameters:
      n - the node to copy
      Returns:
      this node
    • getR

      public double getR()
      Get the radius r of this 3D node.
      Returns:
      the radius
    • setR

      public Node3D setR(double r)
      Set the radius r of the 3D node.
      Parameters:
      r - the new radius
      Returns:
      this node
    • scaleR

      public Node3D scaleR(double scale)
      Description copied from interface: Node
      Scales the radius of this node by scale.
      Specified by:
      scaleR in interface Node
      Parameters:
      scale - the scaling factor
      Returns:
      this node
    • distance2

      public double distance2(Node3D m)
      Calculate the distance squared between this 3D node n and node m. 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

      public double distance(Node3D m)
      Calculate the distance between this 3D node n and node m. 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

      public String toString()
      Overrides:
      toString in class Point3D