Class MinimalEnclosingParallelepipede

java.lang.Object
org.jeometry.geom3D.algorithm.bounds.MinimalEnclosingParallelepipede

public class MinimalEnclosingParallelepipede
extends Object
This class is an implementation of the algorithm given in "Minimal Enclosing Parallelepiped in 3D", december 2002 by Frédéric Vivien and Nicolas Wicker (Laboratoire de l'Informatique du parallelisme, Ecole Normale supérieure de Lyon, UMR cnrs-inria-ens Lyon 5668). The complexity of the algorithm is O(n log n + k). The code is:

1: Compute the convex hull C of the set of points S
2: N = NULL {The set of candidate supporting planes}
3: Let F be the set of all the faces of C
4: for each face f of F do
5:   Find the vertex v of C which is the furthest from f
6:   Associate to f the vector nf normal to f and linking f and v (v+nf is a point of f )
7:   N = N [{( f , f −nf ,nf )}
8: Let E be the set of all the edges of C
9: for each pair {e1,e2} of elements of E do
10:   if e1 and e2 are not parallel then
11:     Build the planes f1 and f2 parallel to e1 and e2, f1 containing e1 and f2 including e2
12:     Compute the vector nf1 normal to f1 (and thus to f2) such that f1+nf1 = f2
13:     if C is enclosed in the space between the planes f1 and f2 then
14:       N = N [{( f1, f2,nf1)}
15: vol_min = + infinite
16: planes = NULL
17: for each element ( f1, f01,n1) of N do
18:   for each element ( f2, f02,n2) of N do
19:     for each element ( f3, f03,n3) of N do
20:       if n1 ^n2.n3 != 0 then
21:         vol = ||n1||^2 * ||n2||^2 * ||n3||^2 / n1^n2.n3
22:         if vol < vol_min then
23:           vol_min = vol
24:           planes = { f1, f01 , f2, f02, f3, f03 }
25: return planes

Since:
1.0.0
Version:
"1.0.5"
Author:
Julien Seinturier - COMEX S.A. - contact@jorigin.org - https://github.com/jorigin/jeometry
  • Field Details

    • ZERO_LIMIT

      public static double ZERO_LIMIT
      The 0 limit. Under this value, a value is considered as equal to 0
  • Constructor Details

    • MinimalEnclosingParallelepipede

      public MinimalEnclosingParallelepipede()
  • Method Details

    • computeMinimalEnclosingParallelepiped

      public static Mesh<Point3D> computeMinimalEnclosingParallelepiped​(Point3DContainer<Point3D> p3dm)
      Compute the minimal enclosing parallelepiped of a point set. This method is an implementation of the algorithm given in "Minimal Enclosing Parallelepiped in 3D", december 2002 by Frédéric Vivien and Nicolas Wicker (Laboratoire de l'Informatique du parallelisme, Ecole Normale supérieure de Lyon, UMR cnrs-inria-ens Lyon 5668). The complexity of the algorithm is O(n log n + k). The code is:

      1: Compute the convex hull C of the set of points S
      2: N = NULL {The set of candidate supporting planes}
      3: Let F be the set of all the faces of C
      4: for each face f of F do
      5:   Find the vertex v of C which is the furthest from f
      6:   Associate to f the vector nf normal to f and linking f and v (v+nf is a point of f )
      7:   N = N [{( f , f −nf ,nf )}
      8: Let E be the set of all the edges of C
      9: for each pair {e1,e2} of elements of E do
      10:   if e1 and e2 are not parallel then
      11:     Build the planes f1 and f2 parallel to e1 and e2, f1 containing e1 and f2 including e2
      12:     Compute the vector nf1 normal to f1 (and thus to f2) such that f1+nf1 = f2
      13:     if C is enclosed in the space between the planes f1 and f2 then
      14:       N = N [{( f1, f2,nf1)}
      15: vol_min = + infinite
      16: planes = NULL
      17: for each element ( f1, f01,n1) of N do
      18:   for each element ( f2, f02,n2) of N do
      19:     for each element ( f3, f03,n3) of N do
      20:       if n1 ^n2.n3 != 0 then
      21:         vol = ||n1||^2 * ||n2||^2 * ||n3||^2 / n1^n2.n3
      22:         if vol < vol_min then
      23:           vol_min = vol
      24:           planes = { f1, f01 , f2, f02, f3, f03 }
      25: return planes

      Parameters:
      p3dm - Point3DManagerI The points to enclose
      Returns:
      IPolyhedron The polyhedron representing the parallelepiped