Class Sphere

java.lang.Object
cnuphys.adaptiveSwim.geometry.Sphere

public class Sphere extends Object
A sphere centered at an arbitrary point
Author:
heddle
  • Constructor Summary

    Constructors
    Constructor
    Description
    Sphere(Point center, double radius)
    Create a sphere
  • Method Summary

    Modifier and Type
    Method
    Description
    double
    distance(double x, double y, double z)
    Get the shortest distance between the surface of this sphere and a point.
    double
    Get the shortest distance between the surface of this sphere and a point.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • Sphere

      public Sphere(Point center, double radius)
      Create a sphere
      Parameters:
      center - the center of the sphere
      radius - the radius of the sphere
  • Method Details

    • distance

      public double distance(Point p)
      Get the shortest distance between the surface of this sphere and a point. If the value is negative, we are inside the sphere.
      Parameters:
      p - a point
      Returns:
      the distance to the sphere
    • distance

      public double distance(double x, double y, double z)
      Get the shortest distance between the surface of this sphere and a point. If the value is negative, we are inside the sphere.
      Parameters:
      x - the x coordinate
      y - the y coordinate
      z - the z coordinate
      Returns:
      the distance to the sphere