us.ihmc.robotics.geometry.GeometryTools.isLineSegmentIntersectingPlane()方法的使用及代码示例

x33g5p2x  于2022-01-20 转载在 其他  
字(4.1k)|赞(0)|评价(0)|浏览(74)

本文整理了Java中us.ihmc.robotics.geometry.GeometryTools.isLineSegmentIntersectingPlane()方法的一些代码示例,展示了GeometryTools.isLineSegmentIntersectingPlane()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。GeometryTools.isLineSegmentIntersectingPlane()方法的具体详情如下:
包路径:us.ihmc.robotics.geometry.GeometryTools
类名称:GeometryTools
方法名:isLineSegmentIntersectingPlane

GeometryTools.isLineSegmentIntersectingPlane介绍

[英]Test if a given line segment intersects a given plane.

Edge cases:

  • the line segment endpoints are equal, this method returns false whether the endpoints are on the plane or not.
  • one of the line segment endpoints is exactly on the plane, this method returns false.
    [中]测试给定线段是否与给定平面相交。
    边缘情况:
    *线段端点相等,无论端点是否在平面上,此方法都返回false。
    *其中一个线段端点正好位于平面上,此方法返回false。

代码示例

代码示例来源: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));
}

相关文章