本文整理了Java中us.ihmc.robotics.geometry.GeometryTools.isLineSegmentIntersectingPlane()
方法的一些代码示例,展示了GeometryTools.isLineSegmentIntersectingPlane()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。GeometryTools.isLineSegmentIntersectingPlane()
方法的具体详情如下:
包路径:us.ihmc.robotics.geometry.GeometryTools
类名称:GeometryTools
方法名:isLineSegmentIntersectingPlane
[英]Test if a given line segment intersects a given plane.
Edge cases:
代码示例来源:origin: us.ihmc/IHMCRoboticsToolkit
if (isLineSegmentIntersectingPlane(pointOnPlane, planeNormal, lineSegmentStart, lineSegmentEnd))
代码示例来源:origin: us.ihmc/IHMCRoboticsToolkit
/**
* Test if a given line segment intersects a given plane.
* <p>
* Edge cases:
* <ul>
* <li> the line segment endpoints are equal, this method returns false whether the endpoints are on the plane or not.
* <li> one of the line segment endpoints is exactly on the plane, this method returns false.
* </ul>
* </p>
*
* @param pointOnPlane a point located on the plane. Not modified.
* @param planeNormal the normal of the plane. Not modified.
* @param lineSegmentStart first endpoint of the line segment. Not modified.
* @param lineSegmentEnd second endpoint of the line segment. Not modified.
* @return {@code true} if an intersection line segment - plane exists, {@code false} otherwise.
* @throws ReferenceFrameMismatchException if the arguments are not expressed in the same reference frame.
*/
public static boolean isLineSegmentIntersectingPlane(FramePoint pointOnPlane, FrameVector planeNormal, FramePoint lineSegmentStart,
FramePoint lineSegmentEnd)
{
pointOnPlane.checkReferenceFrameMatch(planeNormal);
lineSegmentStart.checkReferenceFrameMatch(lineSegmentEnd);
pointOnPlane.checkReferenceFrameMatch(lineSegmentStart);
return isLineSegmentIntersectingPlane(pointOnPlane.getPoint(), planeNormal.getVector(), lineSegmentStart.getPoint(), lineSegmentEnd.getPoint());
}
代码示例来源:origin: us.ihmc/ihmc-robotics-toolkit-test
@ContinuousIntegrationTest(estimatedDuration = 0.0)
@Test(timeout = 30000)
public void testIsLineSegmentIntersectingPlane1()
{
FramePoint3D pointOnPlane = new FramePoint3D(ReferenceFrame.getWorldFrame(), 0, 0, 0);
FrameVector3D planeNormal = new FrameVector3D(pointOnPlane.getReferenceFrame(), 0, 0, 1);
FramePoint3D lineStart = new FramePoint3D(ReferenceFrame.getWorldFrame(), 0, 0, -1);
FramePoint3D lineEnd = new FramePoint3D(ReferenceFrame.getWorldFrame(), 0, 0, 3);
assertTrue(GeometryTools.isLineSegmentIntersectingPlane(pointOnPlane, planeNormal, lineStart, lineEnd));
pointOnPlane = new FramePoint3D(ReferenceFrame.getWorldFrame(), 0, 0, 0);
planeNormal = new FrameVector3D(pointOnPlane.getReferenceFrame(), 1, 0, 0);
lineStart = new FramePoint3D(ReferenceFrame.getWorldFrame(), -6, 3, -3);
lineEnd = new FramePoint3D(ReferenceFrame.getWorldFrame(), 6, 3, 6);
assertTrue(GeometryTools.isLineSegmentIntersectingPlane(pointOnPlane, planeNormal, lineStart, lineEnd));
pointOnPlane = new FramePoint3D(ReferenceFrame.getWorldFrame(), 0, 0, 0);
planeNormal = new FrameVector3D(pointOnPlane.getReferenceFrame(), 0, 1, 0);
lineStart = new FramePoint3D(ReferenceFrame.getWorldFrame(), 6, -3, -3);
lineEnd = new FramePoint3D(ReferenceFrame.getWorldFrame(), 6, 3, 6);
assertTrue(GeometryTools.isLineSegmentIntersectingPlane(pointOnPlane, planeNormal, lineStart, lineEnd));
pointOnPlane = new FramePoint3D(ReferenceFrame.getWorldFrame(), 0, 0, 0);
planeNormal = new FrameVector3D(pointOnPlane.getReferenceFrame(), 0, 0, 1);
lineStart = new FramePoint3D(ReferenceFrame.getWorldFrame(), 6, -3, 3);
lineEnd = new FramePoint3D(ReferenceFrame.getWorldFrame(), 6, 3, 6);
assertFalse(GeometryTools.isLineSegmentIntersectingPlane(pointOnPlane, planeNormal, lineStart, lineEnd));
pointOnPlane = new FramePoint3D(ReferenceFrame.getWorldFrame(), 0, 0, 0);
planeNormal = new FrameVector3D(pointOnPlane.getReferenceFrame(), 0, 0, 1);
lineStart = new FramePoint3D(ReferenceFrame.getWorldFrame(), 6, -3, -3);
lineEnd = new FramePoint3D(ReferenceFrame.getWorldFrame(), 6, 3, -1);
assertFalse(GeometryTools.isLineSegmentIntersectingPlane(pointOnPlane, planeNormal, lineStart, lineEnd));
}
内容来源于网络,如有侵权,请联系作者删除!