DzBox3 getIntersection question

For WSBoundingBox (DzBox3) how do the firstIntersection and secondIntersection calculated values work?

The following results do not make sense to me.

Have aligned to x and y for simplicity. Have tried it using different orientations and different node types and inverting the line direction.

For a bounding box why is the firstIntersection zero when line origin is above or below particular values? How do those values relate to the boundingbox and or the ray line?

Should secondIntersection be renamed as minimumIntersection?

CODE:
 DzVec3 lineOrigin = sphere->getWSPos();
 DzVec3 lineEnd = DzVec3(lineOrigin.m_x, lineOrigin.m_y - 10000, lineOrigin.m_z);
 DzLine3 lineRay = DzLine3(lineOrigin , lineEnd);
 DzVec3 firstHit;
 DzVec3 lastHit;
 cube.getIntersection(lineRay, &firstHit, &lastHit);

BOUNDINGBOX VALUES:
 cube WSPos at x= 0 y= 22.8144 z= 0
 cube WSBoundingBox MinY= 20 MaxY= 120
 sphere (a Null) radius= 10

TESTS RESULTS WITH DIFFERENT LINE VALUES:
 sphere WSPos at x= 0 y= 200 z= 0
 firstHit at x= 0 y= 0 z= 0
 lastHit at x= 0 y= 20 z= 0
 .
 .
 .
 sphere WSPos at x= 0 y= 121 z= 0
 firstHit at x= 0 y= 0 z= 0
 lastHit at x= 0 y= 20 z= 0

 sphere WSPos at x= 0 y= 120 z= 0
 firstHit at x= 0 y= 120 z= 0
 lastHit at x= 0 y= 20 z= 0

 sphere WSPos at x= 0 y= 110 z= 0
 firstHit at x= 0 y= 100 z= 0
 lastHit at x= 0 y= 20 z= 0

 sphere WSPos at x= 0 y= 80 z= 0
 firstHit at x= 0 y= 40 z= 0
 lastHit at x= 0 y= 20 z= 0

 sphere WSPos at x= 0 y= 70 z= 0
 firstHit at x= 0 y= 20 z= 0
 lastHit at x= 0 y= 20 z= 0

 sphere WSPos at x= 0 y= 69 z= 0
 firstHit at x= 0 y= 0 z= 0
 lastHit at x= 0 y= 20 z= 0
 .
 .
 .
 sphere WSPos at x= 0 y= -100 z= 0
 firstHit at x= 0 y= 0 z= 0
 lastHit at x= 0 y= 20 z= 0

Comments

  • surrealsurreal Posts: 152

    Cut and paste error in test results above. cube WSPos should be y=20  (i.e. minY)

    BOUNDINGBOX VALUES:
     cube WSPos at x= 0 y= 20 z= 0
     cube WSBoundingBox MinY= 20 MaxY= 120
     sphere (a Null) radius= 10

Sign In or Register to comment.