本文整理汇总了C#中INode.GetCoords方法的典型用法代码示例。如果您正苦于以下问题:C# INode.GetCoords方法的具体用法?C# INode.GetCoords怎么用?C# INode.GetCoords使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类INode
的用法示例。
在下文中一共展示了INode.GetCoords方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ProcessTerminal
private void ProcessTerminal(INode node, float tx0, float ty0, float tz0)
{
var entryDistance = Mathf.Max(tx0, ty0, tz0);
var entryPlane = GetEntryPlane(tx0, ty0, tz0);
var normal = GetNormal(entryPlane);
if (_debug) {
const float normalSize = 1f;
Debug.DrawLine(_ray.origin, _ray.GetPoint(entryDistance), Color.white, 0, false);
Debug.DrawLine(_ray.GetPoint(entryDistance),
_ray.GetPoint(entryDistance) + _transform.TransformDirection(normal) * normalSize, Color.green, 0, false);
var bounds = node.GetBounds();
DrawBounds(bounds, Color.cyan, true);
}
var result = new RayIntersectionResult(_tree, node, node.GetCoords(), entryDistance, _ray.GetPoint(entryDistance),
normal, GetNeighbourSide(entryPlane));
if (_filter == null || _filter(result)) {
results.Add(result);
}
}
示例2: RayIntersection
public RayIntersection(Transform transform, IOctree octree, Ray r, bool intersectMultiple, int? wantedDepth,
Filter filter, bool debug = false)
{
_filter = filter;
_debug = debug;
_tree = octree;
_rootNode = octree.GetRoot();
if (_rootNode == null) {
//we had a good run guys, time to call it a day
return;
}
_transform = transform;
_ray = r;
_intersectMultiple = intersectMultiple;
_dimensionFlipFlags = 0;
var rootBounds = _rootNode.GetBounds();
if (_debug) {
DrawBounds(rootBounds, Color.gray);
}
var rootCenter = rootBounds.center;
var ro = transform.InverseTransformPoint(r.origin) - rootCenter;
var rd = transform.InverseTransformDirection(r.direction);
var rox = ro.x;
var roy = ro.y;
var roz = ro.z;
var rdx = rd.x;
var rdy = rd.y;
var rdz = rd.z;
var ocMin = rootBounds.min - rootCenter;
var ocMax = rootBounds.max - rootCenter;
if (rdx < 0.0f) {
rox = -rox;
rdx = -rdx;
_dimensionFlipFlags |= 1;
}
if (rdy < 0.0f) {
roy = -roy;
rdy = -rdy;
_dimensionFlipFlags |= 2;
}
if (rdz < 0.0f) {
roz = -roz;
rdz = -rdz;
_dimensionFlipFlags |= 4;
}
float tx0, tx1, ty0, ty1, tz0, tz1;
if (!Mathf.Approximately(rdx, 0.0f)) {
tx0 = (ocMin.x - rox) / rdx;
tx1 = (ocMax.x - rox) / rdx;
} else {
tx0 = 99999.9f;
tx1 = 99999.9f;
}
if (!Mathf.Approximately(rdy, 0.0f)) {
ty0 = (ocMin.y - roy) / rdy;
ty1 = (ocMax.y - roy) / rdy;
} else {
ty0 = 99999.9f;
ty1 = 99999.9f;
}
if (!Mathf.Approximately(rdz, 0.0f)) {
tz0 = (ocMin.z - roz) / rdz;
tz1 = (ocMax.z - roz) / rdz;
} else {
tz0 = 99999.9f;
tz1 = 99999.9f;
}
if (_debug) {
Debug.DrawLine(_ray.origin, _ray.GetPoint(5000), Color.yellow);
}
if (Mathf.Max(tx0, ty0, tz0) < Mathf.Min(tx1, ty1, tz1)) {
ProcSubtree(tx0, ty0, tz0, tx1, ty1, tz1, _rootNode, _rootNode.IsSolid(), 0, wantedDepth,
_rootNode.GetCoords());
}
}