本文整理汇总了C#中Plane.DotNormal方法的典型用法代码示例。如果您正苦于以下问题:C# Plane.DotNormal方法的具体用法?C# Plane.DotNormal怎么用?C# Plane.DotNormal使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Plane
的用法示例。
在下文中一共展示了Plane.DotNormal方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Split
private void Split(OCTPoly poly, Plane p, ref OCTPoly[] newPolys, out int numPolys)
{
numPolys = 0;
var num = p.DotCoordinate(poly.Verts[0]);
var num2 = p.DotCoordinate(poly.Verts[1]);
var num3 = p.DotCoordinate(poly.Verts[2]);
var vector = MathExtensions.NormalFromPoints(poly.Verts[0], poly.Verts[1], poly.Verts[2]);
if (((num > 0f) && (num2 > 0f)) && (num3 > 0f))
{
newPolys[0] = new OCTPoly(poly.Verts[0], poly.Verts[1], poly.Verts[2]);
numPolys = 1;
}
else if (((num < 0f) && (num2 < 0f)) && (num3 < 0f))
{
numPolys = 0;
}
else if (((num == 0f) && (num2 == 0f)) && (num3 == 0f))
{
if (p.DotNormal(vector) >= 0f)
{
newPolys[0] = new OCTPoly(poly.Verts[0], poly.Verts[1], poly.Verts[2]);
numPolys = 1;
}
else
{
numPolys = 0;
}
}
else
{
var vectorArray = new Vector3[4];
var num4 = 0;
for (var i = 0; i < 3; i++)
{
var vector2 = poly.Verts[i];
var vector3 = poly.Verts[((i + 1) > 2) ? 0 : (i + 1)];
var num6 = p.DotCoordinate(vector2);
var num7 = p.DotCoordinate(vector3);
if (num6 >= 0f)
{
vectorArray[num4++] = vector2;
}
if (((num7 <= 0f) && (num6 > 0f)) || ((num7 >= 0f) && (num6 < 0f)))
{
var zero = Vector3.Zero;
if (Intersection.LineSegmentIntersectsPlane(vector2, vector3, p, ref zero))
{
vectorArray[num4++] = zero;
}
}
}
switch (num4)
{
case 3:
case 4:
newPolys[0] = new OCTPoly(vectorArray[0], vectorArray[1], vectorArray[2]);
numPolys = 1;
if (num4 == 4)
{
newPolys[1] = new OCTPoly(vectorArray[0], vectorArray[2], vectorArray[3]);
numPolys = 2;
}
break;
}
}
}