Skip to content

Commit

Permalink
To avoid error messages during compilation due to the absence of the
Browse files Browse the repository at this point in the history
intersectionWith method for some shapes, I added an exception returning
'Intersection line capsule isn't supported'.
  • Loading branch information
vroy committed May 1, 2024
1 parent 095823e commit 66a1ca1
Show file tree
Hide file tree
Showing 10 changed files with 81 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import us.ihmc.euclid.shape.convexPolytope.interfaces.ConvexPolytope3DReadOnly;
import us.ihmc.euclid.shape.convexPolytope.interfaces.Vertex3DReadOnly;
import us.ihmc.euclid.tools.EuclidCoreIOTools;
import us.ihmc.euclid.tuple3D.interfaces.Point3DBasics;
import us.ihmc.euclid.tuple3D.interfaces.Point3DReadOnly;
import us.ihmc.euclid.tuple3D.interfaces.Vector3DReadOnly;

Expand Down Expand Up @@ -92,6 +93,15 @@ default FrameVertex3DReadOnly getVertex(int index)
{
return getVertices().get(index);
}

@Override
default int intersectionWith(Point3DReadOnly pointOnLine,
Vector3DReadOnly lineDirection,
Point3DBasics firstIntersectionToPack,
Point3DBasics secondIntersectionToPack)
{
throw new UnsupportedOperationException("Intersection line capsule isn't supported.");
}

/** {@inheritDoc} */
@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -334,6 +334,8 @@ default FrameHalfEdge3DReadOnly getClosestEdge(FramePoint3DReadOnly query)
checkReferenceFrameMatch(query);
return (FrameHalfEdge3DReadOnly) Face3DReadOnly.super.getClosestEdge(query);
}



/** {@inheritDoc} */
@Override
Expand Down Expand Up @@ -507,4 +509,6 @@ default String toString(String format)
{
return EuclidFrameShapeIOTools.getFrameFace3DString(format, this);
}


}
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,17 @@ default void getBoundingBox(BoundingBox3DBasics boundingBoxToPack)
double getConstructionEpsilon();

/** {@inheritDoc} */

@Override
default int intersectionWith(Point3DReadOnly pointOnLine,
Vector3DReadOnly lineDirection,
Point3DBasics firstIntersectionToPack,
Point3DBasics secondIntersectionToPack)
{
throw new UnsupportedOperationException("Intersection line capsule isn't supported.");
}


@Override
default boolean containsNaN()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,9 @@ default boolean evaluatePoint3DCollision(Point3DReadOnly pointToCheck, Point3DBa

return distance <= 0.0;
}




/** {@inheritDoc} */
@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@
import us.ihmc.euclid.geometry.interfaces.BoundingBox3DReadOnly;
import us.ihmc.euclid.shape.convexPolytope.interfaces.ConvexPolytope3DReadOnly;
import us.ihmc.euclid.shape.convexPolytope.interfaces.Face3DReadOnly;
import us.ihmc.euclid.tuple3D.interfaces.Point3DBasics;
import us.ihmc.euclid.tuple3D.interfaces.Point3DReadOnly;
import us.ihmc.euclid.tuple3D.interfaces.Vector3DReadOnly;

/**
* Provides a {@link ConvexPolytope3DReadOnly} view backed by a {@link Box3DReadOnly}.
Expand Down Expand Up @@ -125,6 +127,7 @@ default Box3DBasics copy()
{
return getOwner().copy();
}


/** {@inheritDoc} */
@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,15 @@ default boolean evaluatePoint3DCollision(Point3DReadOnly pointToCheck, Point3DBa
normalAtClosestPointToPack) <= 0.0;
}

@Override
default int intersectionWith(Point3DReadOnly pointOnLine,
Vector3DReadOnly lineDirection,
Point3DBasics firstIntersectionToPack,
Point3DBasics secondIntersectionToPack)
{
throw new UnsupportedOperationException("Intersection line capsule isn't supported.");
}

/** {@inheritDoc} */
@Override
default boolean getSupportingVertex(Vector3DReadOnly supportDirection, Point3DBasics supportingVertexToPack)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,15 @@ default boolean evaluatePoint3DCollision(Point3DReadOnly pointToCheck, Point3DBa
return false;
}

@Override
default int intersectionWith(Point3DReadOnly pointOnLine,
Vector3DReadOnly lineDirection,
Point3DBasics firstIntersectionToPack,
Point3DBasics secondIntersectionToPack)
{
throw new UnsupportedOperationException("Intersection line capsule isn't supported.");
}

/** {@inheritDoc} */
@Override
default boolean getSupportingVertex(Vector3DReadOnly supportDirection, Point3DBasics supportingVertexToPack)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,17 @@ default boolean evaluatePoint3DCollision(Point3DReadOnly pointToCheck, Point3DBa
return distance <= 0.0;
}


@Override
default int intersectionWith(Point3DReadOnly pointOnLine,
Vector3DReadOnly lineDirection,
Point3DBasics firstIntersectionToPack,
Point3DBasics secondIntersectionToPack)
{
throw new UnsupportedOperationException("Intersection line capsule isn't supported.");
}


/** {@inheritDoc} */
@Override
default boolean getSupportingVertex(Vector3DReadOnly supportDirection, Point3DBasics supportingVertexToPack)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,14 @@
import us.ihmc.euclid.geometry.BoundingBox3D;
import us.ihmc.euclid.geometry.interfaces.BoundingBox3DBasics;
import us.ihmc.euclid.geometry.interfaces.BoundingBox3DReadOnly;
import us.ihmc.euclid.geometry.interfaces.Line3DReadOnly;
import us.ihmc.euclid.interfaces.EuclidGeometry;
import us.ihmc.euclid.shape.collision.interfaces.SupportingVertexHolder;
import us.ihmc.euclid.tuple3D.Point3D;
import us.ihmc.euclid.tuple3D.interfaces.Point3DBasics;
import us.ihmc.euclid.tuple3D.interfaces.Point3DReadOnly;
import us.ihmc.euclid.tuple3D.interfaces.Vector3DBasics;
import us.ihmc.euclid.tuple3D.interfaces.Vector3DReadOnly;

/**
* Read-only interface for representing a 3D shape.
Expand Down Expand Up @@ -51,6 +53,16 @@ public interface Shape3DReadOnly extends SupportingVertexHolder, EuclidGeometry
*/
boolean evaluatePoint3DCollision(Point3DReadOnly pointToCheck, Point3DBasics closestPointOnSurfaceToPack, Vector3DBasics normalAtClosestPointToPack);

default int intersectionWith(Line3DReadOnly line, Point3DBasics firstIntersectionToPack, Point3DBasics secondIntersectionToPack)
{
return intersectionWith(line.getPoint(), line.getDirection(), firstIntersectionToPack, secondIntersectionToPack);
}

int intersectionWith(Point3DReadOnly pointOnLine,
Vector3DReadOnly lineDirection,
Point3DBasics firstIntersectionToPack,
Point3DBasics secondIntersectionToPack);

/**
* Calculates the minimum distance between a point and this shape.
* <p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,15 @@ default boolean evaluatePoint3DCollision(Point3DReadOnly pointToCheck, Point3DBa
closestPointOnSurfaceToPack,
normalAtClosestPointToPack) <= 0.0;
}

@Override
default int intersectionWith(Point3DReadOnly pointOnLine,
Vector3DReadOnly lineDirection,
Point3DBasics firstIntersectionToPack,
Point3DBasics secondIntersectionToPack)
{
throw new UnsupportedOperationException("Intersection line capsule isn't supported.");
}

/** {@inheritDoc} */
@Override
Expand Down

0 comments on commit 66a1ca1

Please sign in to comment.