org.apache.commons.math3.geometry.euclidean.threed
Class InfiniteRectangleCylinder

java.lang.Object
  extended by org.apache.commons.math3.geometry.euclidean.threed.InfiniteRectangleCylinder
All Implemented Interfaces:
InfiniteCylinder, InfiniteShape, Shape

public final class InfiniteRectangleCylinder
extends Object
implements InfiniteCylinder

This is a describing class for a 3D infinite rectangle cylinder, with some algorithm to compute intersections and distances to some other objects.

Since:
1.0
Version:
$Id: InfiniteRectangleCylinder.java 16755 2016-10-07 15:47:40Z bignon $
Author:
Thomas Trapier
See Also:
Shape.distanceTo(Line), Shape.intersects(Line)
Use sample :

Creation with its dimensions and three Vector3D : Vector3D origin = new Vector3D(1.0, 6.0, -2.0); Vector3D direction = new Vector3D(6.0, -3.0, -1.0); Vector3D uVector = new Vector3D(-5.0, 3.0, 0.0); double length = 2.0; double width = 3.0; InfiniteRectangleCylinder cylinder = new InfiniteRectangleCylinder(origin, direction, uVector, length, width); Creation with a line, a Vector3D (u vector) and the dimensions : InfiniteRectangleCylinder cylinder = new InfiniteRectangleCylinder(line, uVector, length, width); Intersection with a line : boolean intersects = cylinder(line);

Concurrency :
immutable

Constructor Summary
InfiniteRectangleCylinder(Line inDirection, Vector3D inUVector, double inLength, double inWidth)
          Build an infinite rectangle cylinder from its dimensions, orientation and the origin and direction of its axis
InfiniteRectangleCylinder(Vector3D inOrigin, Vector3D inDirection, Vector3D inUvector, double inLength, double inWidth)
          Build an infinite rectangle cylinder from its dimensions, orientation and the origin and direction of its axis
 
Method Summary
 Vector3D[] closestPointTo(Line line)
          Computes the points of the shape and the line realizing the shortest distance.
 double distanceTo(Line line)
          Computes the distance to a line.
 Vector3D getDirection()
           
 Vector3D[] getIntersectionPoints(Line line)
          Compute the intersection points with a line.
 double getLength()
           
 Vector3D getOrigin()
           
 Vector3D getU()
           
 Vector3D getV()
           
 double getWidth()
           
 boolean intersects(Line line)
          Tests the intersection with a line.
 String toString()
          Get a representation for this infinite rectangle cylinder.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

InfiniteRectangleCylinder

public InfiniteRectangleCylinder(Line inDirection,
                                 Vector3D inUVector,
                                 double inLength,
                                 double inWidth)
Build an infinite rectangle cylinder from its dimensions, orientation and the origin and direction of its axis

Parameters:
inDirection - the direction (middle axis of the cylinder)
inUVector - the approximative U vector of the frame : corrected to be orthogonal to the direction
inLength - dimension on the U axis
inWidth - dimension on the V axis
Throws:
IllegalArgumentException - if one of the dimensions is negative or null, or if the direction vector has a null norm.

InfiniteRectangleCylinder

public InfiniteRectangleCylinder(Vector3D inOrigin,
                                 Vector3D inDirection,
                                 Vector3D inUvector,
                                 double inLength,
                                 double inWidth)
Build an infinite rectangle cylinder from its dimensions, orientation and the origin and direction of its axis

Parameters:
inOrigin - the origin of the axis
inDirection - the direction of the axis
inUvector - the approximative U vector of the frame
inLength - dimension on the U axis
inWidth - dimension on the V axis
Throws:
IllegalArgumentException - if one of the dimensions is negative or null, or if the direction vector has a null norm.
Method Detail

getOrigin

public Vector3D getOrigin()
Returns:
the origin

getDirection

public Vector3D getDirection()
Returns:
the direction

getU

public Vector3D getU()
Returns:
the u vector of the frame

getV

public Vector3D getV()
Returns:
the v vector of the frame

getLength

public double getLength()
Returns:
the length

getWidth

public double getWidth()
Returns:
the width

intersects

public boolean intersects(Line line)
Tests the intersection with a line.

Specified by:
intersects in interface Shape
Parameters:
line - the line
Returns:
true if the line intersects the shape

getIntersectionPoints

public Vector3D[] getIntersectionPoints(Line line)
Compute the intersection points with a line.

Specified by:
getIntersectionPoints in interface Shape
Parameters:
line - the line
Returns:
the intersection points if they exist. If no intersection is found, the dimension is zero

distanceTo

public double distanceTo(Line line)
Computes the distance to a line.

Specified by:
distanceTo in interface Shape
Parameters:
line - the line
Returns:
the shortest distance between the the line and the shape

closestPointTo

public Vector3D[] closestPointTo(Line line)
Computes the points of the shape and the line realizing the shortest distance. If the line intersects the shape, the returned points are identical : this point is the first common point found.

Specified by:
closestPointTo in interface Shape
Parameters:
line - the line
Returns:
the two points : first the one from the line, and the one from the shape.

toString

public String toString()
Get a representation for this infinite rectangle cylinder. The given parameters are in the same order as in the constructor.

Overrides:
toString in class Object
Returns:
a representation for this infinite rectangle cylinder


Copyright © 2016 CNES. All Rights Reserved.