本文整理汇总了C#中System.Windows.Media.Media3D.Point3D.TransformToBounds方法的典型用法代码示例。如果您正苦于以下问题:C# Point3D.TransformToBounds方法的具体用法?C# Point3D.TransformToBounds怎么用?C# Point3D.TransformToBounds使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Media.Media3D.Point3D
的用法示例。
在下文中一共展示了Point3D.TransformToBounds方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DrawLine
protected void DrawLine(Point3D point)
{
// point was in cube [0..1]x[0..1]x[0..1], we are transforming it
// to cube [0..width]x[0..height]x[0..depth]
Point3D start = point.TransformToBounds(bounds);
int maxLength = 10 * Math.Max(width, Math.Max(height, depth));
const int maxIterations = 400;
Size3D boundsSize = new Size3D(1.0 / width, 1.0 / height, 1.0 / depth);
Action<double, List<Point3D>> pointTracking = (direction, track) =>
{
var position01 = point;
double length = 0;
int i = 0;
do
{
var K1 = fieldWrapper.GetVector(position01).DecreaseLength(boundsSize);
var K2 = fieldWrapper.GetVector(position01 + (K1 / 2)).DecreaseLength(boundsSize);
var K3 = fieldWrapper.GetVector(position01 + (K2 / 2)).DecreaseLength(boundsSize);
var K4 = fieldWrapper.GetVector(position01 + K3).DecreaseLength(boundsSize);
var shift = ((K1 + 2 * K2 + 2 * K3 + K4) / 6);
if (shift.X.IsNaN() || shift.Y.IsNaN() || shift.Z.IsNaN())
break;
var next = position01 + direction * shift;
Point3D viewportPoint = position01.TransformToBounds(bounds);
track.Add(viewportPoint);
position01 = next;
length += shift.Length;
i++;
} while (length < maxLength && i < maxIterations);
};
var forwardTrack = new List<Point3D>();
forwardTrack.Add(start);
pointTracking(+1, forwardTrack);
if (forwardTrack.Count > 1)
{
var forwardLine = CreatePolyline(forwardTrack, start);
Children.Add(forwardLine);
}
var backwardTrack = new List<Point3D>();
backwardTrack.Add(start);
pointTracking(-1, backwardTrack);
if (backwardTrack.Count > 1)
{
var backwardLine = CreatePolyline(backwardTrack, start);
Children.Add(backwardLine);
}
}