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

java.lang.Object
  extended by org.apache.commons.math3.geometry.euclidean.threed.Plate
All Implemented Interfaces:
Serializable, CrossSectionProvider, Shape, SolidShape

public final class Plate
extends Object
implements SolidShape, CrossSectionProvider, Serializable

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

Since:
1.0
Version:
$Id: Plate.java 11374 2014-10-30 15:39:29Z sabatini $
Author:
Thomas Trapier
See Also:
Shape.distanceTo(Line), Shape.intersects(Line), Serialized Form
Use sample :

Creation with three Vector3D and two doubles : Plate plate = new plate(center, vectorU, pseudoVectorV, length, width); Intersection with a line : boolean intersects = plate.intersects(line);

Concurrency :
immutable

Constructor Summary
Plate(Vector3D inCenter, Vector3D inU, Vector3D inV, double inLength, double inWidth)
          Build a plate from the position of its center and two vectors to describe its local frame and dimensions.
 
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 getC1()
           
 Vector3D getC2()
           
 Vector3D getC3()
           
 Vector3D getC4()
           
 Vector3D getCenter()
           
 double getCrossSection(Vector3D direction)
          Computes the cross section from the direction defined by a Vector3D.
 LineSegment[] getEdges()
           
 Vector3D[] getIntersectionPoints(Line line)
          Compute the intersection points with a line.
 double getLength()
           
 Vector3D getU()
           
 Vector3D getV()
           
 double getWidth()
           
 boolean intersects(Line line)
          Tests the intersection with a line.
 String toString()
          Get a representation for this plate.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Plate

public Plate(Vector3D inCenter,
             Vector3D inU,
             Vector3D inV,
             double inLength,
             double inWidth)
Build a plate from the position of its center and two vectors to describe its local frame and dimensions.

Parameters:
inCenter - the center of the plate
inU - a non-normalised vector parallel to u
inV - the second vector defining the plate's plane : corrected to be orthogonal to U
inLength - the rectangle's length along U
inWidth - the rectangle's width along V (once corrected)
Throws:
IllegalArgumentException - if the vectors do not define a plane, or if the dimensions are negative or null
Method Detail

getU

public Vector3D getU()
Returns:
the U vector of the local frame

getV

public Vector3D getV()
Returns:
the V vector of the local frame

getC1

public Vector3D getC1()
Returns:
the first corner

getC2

public Vector3D getC2()
Returns:
the second corner

getC3

public Vector3D getC3()
Returns:
the third corner

getC4

public Vector3D getC4()
Returns:
the fourth corner

getLength

public double getLength()
Returns:
the length

getWidth

public double getWidth()
Returns:
the width

getCenter

public Vector3D getCenter()
Returns:
the center point

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 plate. The given parameters are in the same order as in the constructor.

Overrides:
toString in class Object
Returns:
a representation for this plate

getCrossSection

public double getCrossSection(Vector3D direction)
Computes the cross section from the direction defined by a Vector3D.

Specified by:
getCrossSection in interface CrossSectionProvider
Parameters:
direction - the direction vector
Returns:
the cross section

getEdges

public LineSegment[] getEdges()
Returns:
the edges of the plate


Copyright © 2016 CNES. All Rights Reserved.