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

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

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

GeometryTools.getPlaneNormalGivenThreePoints介绍

[英]Computes the normal of a plane that is defined by three points.

Edge cases:

  • Returns a null if the three points are on a line.
  • Returns null if two or three points are equal.

WARNING: This method generates garbage.
[中]计算由三个点定义的平面的法线。
边缘情况:
*如果三个点在一条线上,则返回null。
*如果两个或三个点相等,则返回null。
警告:此方法生成垃圾。

代码示例

代码示例来源:origin: us.ihmc/ihmc-robotics-toolkit

/**
* Computes the normal of a plane that is defined by three points.
* <p>
* Edge cases:
* <ul>
*    <li> Returns a {@code null} if the three points are on a line.
*    <li> Returns {@code null} if two or three points are equal.
* </ul>
* </p>
* <p>
* WARNING: This method generates garbage.
* </p>
*
* @param firstPointOnPlane first point on the plane. Not modified.
* @param secondPointOnPlane second point on the plane. Not modified.
* @param thirdPointOnPlane third point on the plane. Not modified.
* @return the plane normal or {@code null} when the normal could not be determined.
* @throws ReferenceFrameMismatchException if the arguments are not expressed in the same reference frame.
*/
public static FrameVector3D getPlaneNormalGivenThreePoints(FramePoint3D firstPointOnPlane, FramePoint3D secondPointOnPlane, FramePoint3D thirdPointOnPlane)
{
 FrameVector3D normal = new FrameVector3D();
 boolean success = getPlaneNormalGivenThreePoints(firstPointOnPlane, secondPointOnPlane, thirdPointOnPlane, normal);
 if (!success)
   return null;
 else
   return normal;
}

代码示例来源:origin: us.ihmc/IHMCRoboticsToolkit

/**
* Computes the normal of a plane that is defined by three points.
* <p>
* Edge cases:
* <ul>
*    <li> Returns a {@code null} if the three points are on a line.
*    <li> Returns {@code null} if two or three points are equal.
* </ul>
* </p>
* <p>
* WARNING: This method generates garbage.
* </p>
*
* @param firstPointOnPlane first point on the plane. Not modified.
* @param secondPointOnPlane second point on the plane. Not modified.
* @param thirdPointOnPlane third point on the plane. Not modified.
* @return the plane normal or {@code null} when the normal could not be determined.
* @throws ReferenceFrameMismatchException if the arguments are not expressed in the same reference frame.
*/
public static FrameVector getPlaneNormalGivenThreePoints(FramePoint firstPointOnPlane, FramePoint secondPointOnPlane, FramePoint thirdPointOnPlane)
{
 FrameVector normal = new FrameVector();
 boolean success = getPlaneNormalGivenThreePoints(firstPointOnPlane, secondPointOnPlane, thirdPointOnPlane, normal);
 if (!success)
   return null;
 else
   return normal;
}

代码示例来源:origin: us.ihmc/IHMCRoboticsToolkit

/**
* Computes the normal of a plane that is defined by three points.
* <p>
* Edge cases:
* <ul>
*    <li> Returns a {@code null} if the three points are on a line.
*    <li> Returns {@code null} if two or three points are equal.
* </ul>
* </p>
* <p>
* WARNING: This method generates garbage.
* </p>
*
* @param firstPointOnPlane first point on the plane. Not modified.
* @param secondPointOnPlane second point on the plane. Not modified.
* @param thirdPointOnPlane third point on the plane. Not modified.
* @return the plane normal or {@code null} when the normal could not be determined.
*/
public static Vector3d getPlaneNormalGivenThreePoints(Point3d firstPointOnPlane, Point3d secondPointOnPlane, Point3d thirdPointOnPlane)
{
 Vector3d normal = new Vector3d();
 boolean success = getPlaneNormalGivenThreePoints(firstPointOnPlane, secondPointOnPlane, thirdPointOnPlane, normal);
 if (!success)
   return null;
 else
   return normal;
}

代码示例来源:origin: us.ihmc/IHMCRoboticsToolkit

/**
* Computes the normal of a plane that is defined by three points.
* <p>
* Edge cases:
* <ul>
*    <li> Fails and returns {@code false} if the three points are on a line.
*    <li> Fails and returns {@code false} if two or three points are equal.
* </ul>
* </p>
*
* @param firstPointOnPlane first point on the plane. Not modified.
* @param secondPointOnPlane second point on the plane. Not modified.
* @param thirdPointOnPlane third point on the plane. Not modified.
* @param normalToPack the vector in which the result is stored. Modified.
* @return whether the plane normal is properly determined.
* @throws ReferenceFrameMismatchException if the arguments are not expressed in the same reference frame, except for {@code normalToPack}.
*/
public static boolean getPlaneNormalGivenThreePoints(FramePoint firstPointOnPlane, FramePoint secondPointOnPlane, FramePoint thirdPointOnPlane,
                          FrameVector normalToPack)
{
 firstPointOnPlane.checkReferenceFrameMatch(secondPointOnPlane);
 firstPointOnPlane.checkReferenceFrameMatch(thirdPointOnPlane);
 normalToPack.setToZero(firstPointOnPlane.getReferenceFrame());
 return getPlaneNormalGivenThreePoints(firstPointOnPlane.getPoint(), secondPointOnPlane.getPoint(), thirdPointOnPlane.getPoint(),
                    normalToPack.getVector());
}

代码示例来源:origin: us.ihmc/ihmc-robotics-toolkit-test

FramePoint3D point3 = new FramePoint3D(ReferenceFrame.getWorldFrame(), 0, 5, 0);
FrameVector3D expectedReturn = null;
FrameVector3D actualReturn = GeometryTools.getPlaneNormalGivenThreePoints(point1, point2, point3);
assertEquals("test failed", expectedReturn, actualReturn);
FramePoint3D point93 = new FramePoint3D(ReferenceFrame.getWorldFrame(), 0, 1, 0);
FrameVector3D expectedReturn9 = null;
FrameVector3D actualReturn9 = GeometryTools.getPlaneNormalGivenThreePoints(point91, point92, point93);
assertEquals("test failed", expectedReturn9, actualReturn9);
FramePoint3D point83 = new FramePoint3D(ReferenceFrame.getWorldFrame(), 4, 0, 0);
FrameVector3D expectedReturn8 = null;
FrameVector3D actualReturn8 = GeometryTools.getPlaneNormalGivenThreePoints(point81, point82, point83);
assertEquals("test failed", expectedReturn8, actualReturn8);
FramePoint3D point73 = new FramePoint3D(ReferenceFrame.getWorldFrame(), 0, 0, 7);
FrameVector3D expectedReturn7 = null;
FrameVector3D actualReturn7 = GeometryTools.getPlaneNormalGivenThreePoints(point71, point72, point73);
assertEquals("test failed", expectedReturn7, actualReturn7);
FrameVector3D expectedReturn1 = new FrameVector3D(p1.getReferenceFrame());
expectedReturn1.sub(p1, v1);
FrameVector3D actualReturn1 = GeometryTools.getPlaneNormalGivenThreePoints(point11, point12, point13);
assertTrue("Test Failed", expectedReturn1.epsilonEquals(actualReturn1, EPSILON));
FrameVector3D expectedReturn2 = new FrameVector3D(p2.getReferenceFrame());
expectedReturn2.sub(p2, v2);
FrameVector3D actualReturn2 = GeometryTools.getPlaneNormalGivenThreePoints(point21, point22, point23);
assertTrue("Test Failed", expectedReturn2.epsilonEquals(actualReturn2, EPSILON));

相关文章