本文整理汇总了C#中Plane.GetDistanceToIntersection方法的典型用法代码示例。如果您正苦于以下问题:C# Plane.GetDistanceToIntersection方法的具体用法?C# Plane.GetDistanceToIntersection怎么用?C# Plane.GetDistanceToIntersection使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Plane
的用法示例。
在下文中一共展示了Plane.GetDistanceToIntersection方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SetPrintLevelingEquation
public void SetPrintLevelingEquation(Vector3 position0, Vector3 position1, Vector3 position2, Vector2 bedCenter)
{
if (position0 == position1 || position1 == position2 || position2 == position0)
{
return;
}
Plane planeOfPoints = new Plane(position0, position1, position2);
Ray ray = new Ray(new Vector3(bedCenter, 0), Vector3.UnitZ);
bool inFront;
double distanceToPlaneAtBedCenter = planeOfPoints.GetDistanceToIntersection(ray, out inFront);
Matrix4X4 makePointsFlatMatrix = Matrix4X4.CreateTranslation(-bedCenter.x, -bedCenter.y, -distanceToPlaneAtBedCenter);
makePointsFlatMatrix *= Matrix4X4.CreateRotation(planeOfPoints.planeNormal, Vector3.UnitZ);
makePointsFlatMatrix *= Matrix4X4.CreateTranslation(bedCenter.x, bedCenter.y, 0);//distanceToPlaneAtBedCenter);
bedLevelMatrix = Matrix4X4.Invert(makePointsFlatMatrix);
{
// test that the points come back as 0 zs
Vector3 outPosition0 = Vector3.TransformPosition(position0, makePointsFlatMatrix);
Vector3 outPosition1 = Vector3.TransformPosition(position1, makePointsFlatMatrix);
Vector3 outPosition2 = Vector3.TransformPosition(position2, makePointsFlatMatrix);
Vector3 printPosition0 = new Vector3(ActiveSliceSettings.Instance.GetPrintLevelSamplePosition(0), 0);
Vector3 printPosition1 = new Vector3(ActiveSliceSettings.Instance.GetPrintLevelSamplePosition(1), 0);
Vector3 printPosition2 = new Vector3(ActiveSliceSettings.Instance.GetPrintLevelSamplePosition(2), 0);
Vector3 leveledPositon0 = Vector3.TransformPosition(printPosition0, bedLevelMatrix);
Vector3 leveledPositon1 = Vector3.TransformPosition(printPosition1, bedLevelMatrix);
Vector3 leveledPositon2 = Vector3.TransformPosition(printPosition2, bedLevelMatrix);
}
}