Re: [math] PolyhedronsSets - intersecting a cube diagonally

2019-01-26 Thread Sven Rathgeber

> Please have a look at the fix (in "master" now).

> Thanks a lot for the report,

> Gilles


Hi Gilles and Matt,

the fix works !!! Thanks a lot.

Cheers.

Sven


-
To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org



Re: [math] PolyhedronsSets - intersecting a cube diagonally

2019-01-24 Thread Sven Rathgeber
> Matt Juntunen leads the development of "Commons Geometry".
> Hopefully, he'll have a look at your example.
> Best would be to file a report on the bug-tracking system[1] and
> attach a patch (or a git pull request) to it.

> Thanks,
> Gilles

> [1] https://issues.apache.org/jira/projects/GEOMETRY

Done.

Issue: https://issues.apache.org/jira/browse/GEOMETRY-38
Pull request: https://github.com/apache/commons-geometry/pull/19

Cheers,
Sven

-
To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org



Aw: Re: [math] PolyhedronsSets - intersecting a cube diagonally

2019-01-23 Thread Sven Rathgeber
> Codes in package "o.a.c.m.geometry" of Commons Math are being superseded
> by a new component.[1]
> It is currently in development and we hope to release a beta version soon; you
> are most welcome to help with testing.[2]

> Please try the new project's code, and let us know how it goes.

Thanks for the quick reply.

I checked out the new geometry repo and added my test to

org/apache/commons/geometry/euclidean/threed/PolyhedronsSetTest.java

-> same result. The SubHyperplane is null.

hmm, I'm not sure, if I use the library correctly or if this is a corner case ?

Regards. Sven

-
To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org



[math] PolyhedronsSets - intersecting a cube diagonally

2019-01-22 Thread Sven Rathgeber
Hi,
 
I'm working with PolyhedronsSets. To get a basic understanding
I set up a cube and tried to intersect it diagonally. (apache.commons.math 
3.6.1)
 
When debugging the following test, it looks to me, that Vector(0,0,0) is
ignored, since it is on the border.
 
Hmm, any ideas.
 
Regards. Sven
 

class PolyhedronsSetTest
{
  public static final double DEFAULT_TOLERANCE = 1.0e-10;
  private PolyhedronsSet cube;

  @BeforeEach
  void setup()
  {
    Vector3D[] verts = new Vector3D[8];
    // setting up a cube. length edge 1
    verts[0] = new Vector3D( 1, 0, 0 );
    verts[1] = new Vector3D( 1, 1, 0 );
    verts[2] = new Vector3D( 1, 1, 1 );
    verts[3] = new Vector3D( 1, 0, 1 );
    verts[4] = new Vector3D( 0, 0, 0 );
    verts[5] = new Vector3D( 0, 1, 0 );
    verts[6] = new Vector3D( 0, 1, 1 );
    verts[7] = new Vector3D( 0, 0, 1 );
    int[][] faces = new int[6][];
    faces[0] = new int[] { 0, 4, 5, 1 }; // bottom
    faces[1] = new int[] { 3, 2, 6, 7 }; // top
    faces[2] = new int[] { 1, 5, 6, 2 }; // right
    faces[3] = new int[] { 5, 4, 7, 6 }; // back
    faces[4] = new int[] { 0, 3, 7, 4 }; // left
    faces[5] = new int[] { 0, 1, 2, 3 }; // front
    cube = new PolyhedronsSet( Arrays.asList( verts ), Arrays.asList( faces ), 
DEFAULT_TOLERANCE );
  }

  @Test
  void intersectCubeDiagonally()
  {
    Vector3D start = new Vector3D( -1, -1, -1 );
    Vector3D end = new Vector3D( 1, 1, 1 );
    Line line = new Line( start, end, DEFAULT_TOLERANCE );
    Vector3D origin = new Vector3D( 0.0, 0.0, 0.0 );
    SubHyperplane< Euclidean3D > r = cube.firstIntersection( start, line );
    assertTrue( r != null );
    Plane plane = (Plane) r.getHyperplane();
    Vector3D firstIntersection = plane.intersection( line );
    assertVectorEquals( origin, firstIntersection );
  }

  public void assertVectorEquals(
    Vector3D lhs,
    Vector3D rhs )
  {
    assertEquals( lhs.getX(), rhs.getX(), DEFAULT_TOLERANCE );
    assertEquals( lhs.getY(), rhs.getY(), DEFAULT_TOLERANCE );
    assertEquals( lhs.getZ(), rhs.getZ(), DEFAULT_TOLERANCE );
  }
}

-
To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org