Class CartesianPoint

java.lang.Object
org.djutils.draw.point.Point3d
nl.tudelft.simulation.language.d3.CartesianPoint
All Implemented Interfaces:
Serializable, org.djutils.draw.Drawable<org.djutils.draw.point.Point3d>, org.djutils.draw.Drawable3d, org.djutils.draw.point.Point<org.djutils.draw.point.Point3d>

public class CartesianPoint extends org.djutils.draw.point.Point3d
The Point3D class with utilities to convert to point2D where the z-axis is neglected.

Copyright (c) 2002-2024 Delft University of Technology, Jaffalaan 5, 2628 BX Delft, the Netherlands. All rights reserved. See for project information https://simulation.tudelft.nl. The DSOL project is distributed under a three-clause BSD-style license, which can be found at https://https://simulation.tudelft.nl/dsol/docs/latest/license.html.

Author:
Peter Jacobs
See Also:
  • Field Summary

    Fields inherited from class org.djutils.draw.point.Point3d

    x, y, z
  • Constructor Summary

    Constructors
    Constructor
    Description
    CartesianPoint(double[] xyz)
    constructs a new CartesianPoint.
    CartesianPoint(double x, double y, double z)
    constructs a new CartesianPoint.
    constructs a new CartesianPoint.
  • Method Summary

    Modifier and Type
    Method
    Description
    returns the 2D representation of the point.
    converts the point to a sperical point.
    converts a cartesian point to a sperical point.

    Methods inherited from class org.djutils.draw.point.Point3d

    abs, closestPointOnLine, closestPointOnLine, closestPointOnLine, closestPointOnSegment, closestPointOnSegment, distance, distanceSquared, epsilonEquals, equals, fractionalPositionOnLine, getBounds, getPoints, getX, getY, getZ, hashCode, interpolate, neg, normalize, project, scale, size, toString, translate, translate

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait

    Methods inherited from interface org.djutils.draw.Drawable

    getPointList, toString, toString

    Methods inherited from interface org.djutils.draw.Drawable3d

    getDimensions
  • Constructor Details

    • CartesianPoint

      public CartesianPoint(double x, double y, double z)
      constructs a new CartesianPoint.
      Parameters:
      x - double; x
      y - double; y
      z - double; z
    • CartesianPoint

      public CartesianPoint(double[] xyz)
      constructs a new CartesianPoint.
      Parameters:
      xyz - double[]; x,y,z
    • CartesianPoint

      public CartesianPoint(Point2D point2D)
      constructs a new CartesianPoint.
      Parameters:
      point2D - Point2D; a 2D point
  • Method Details

    • to2D

      public Point2D to2D()
      returns the 2D representation of the point.
      Returns:
      Point2D the result
    • toSphericalPoint

      public SphericalPoint toSphericalPoint()
      converts the point to a sperical point.
      Returns:
      the spherical point
    • toSphericalPoint

      public static SphericalPoint toSphericalPoint(CartesianPoint point)
      converts a cartesian point to a sperical point. See https://mathworld.wolfram.com/SphericalCoordinates.html
      Parameters:
      point - CartesianPoint; the cartesian point
      Returns:
      the spherical point
    • toString

      public String toString()
      Specified by:
      toString in interface org.djutils.draw.Drawable<org.djutils.draw.point.Point3d>
      Overrides:
      toString in class org.djutils.draw.point.Point3d