本文整理汇总了C#中TerraViewer.Vector3d.Length方法的典型用法代码示例。如果您正苦于以下问题:C# Vector3d.Length方法的具体用法?C# Vector3d.Length怎么用?C# Vector3d.Length使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TerraViewer.Vector3d
的用法示例。
在下文中一共展示了Vector3d.Length方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: QueueThread
public static void QueueThread()
{
System.Threading.Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo("en-US", false);
bool fileOnly = fileOnlyThreadID == Thread.CurrentThread.ManagedThreadId;
while (running)
{
if (queue.Count < 1)
{
System.Threading.Thread.Sleep(50);
}
else
{
System.Threading.Thread.Sleep(1);
}
double minDistance = 1000000000000000000;
bool overlayTile = false;
long maxKey = 0;
int level = 1000;
queueMutex.WaitOne();
foreach (Tile t in queue.Values )
{
if (!t.RequestPending ) // && t.InViewFrustum)
{
Vector3d vectTemp = new Vector3d(t.SphereCenter);
vectTemp.TransformCoordinate(Earth3d.WorldMatrix);
if (Earth3d.MainWindow.Space)
{
vectTemp.Subtract(new Vector3d(0.0f, 0.0f, -1.0f));
}
else
{
vectTemp.Subtract(Earth3d.MainWindow.RenderContext11.CameraPosition);
}
double distTemp = Math.Max(0,vectTemp.Length()-t.SphereRadius);
bool thisIsOverlay = (t.Dataset.Projection == ProjectionType.Tangent) || (t.Dataset.Projection == ProjectionType.SkyImage);
if (distTemp < minDistance && (!overlayTile || thisIsOverlay))
{
Tile test = (Tile)queue[t.Key];
if (!test.FileChecked)
{
test.FileExists = File.Exists(test.FileName);
test.FileChecked = true;
if (test.Volitile)
{
test.FileExists = false;
}
}
if (test.FileExists || (!test.FileExists && !fileOnly))
{
minDistance = distTemp;
maxKey = t.Key;
level = t.Level;
overlayTile = thisIsOverlay;
}
}
}
}
if (maxKey != 0)
{
Tile workTile = (Tile)queue[maxKey];
workTile.RequestPending = true;
TileCache.RequestCount++;
queueMutex.ReleaseMutex();
TileCache.GetTileFromWeb(workTile, true);
queueMutex.WaitOne();
TileCache.RequestCount--;
workTile.RequestPending = false;
queue.Remove(workTile.Key);
}
queueMutex.ReleaseMutex();
}
return;
}
示例2: IsTileInFrustum
public virtual bool IsTileInFrustum(PlaneD[]frustum)
{
InViewFrustum = false;
Vector3d center = sphereCenter;
if (this.Level < 2 && (dataset.Projection == ProjectionType.Mercator || dataset.Projection == ProjectionType.Toast))
{
return true;
}
Vector4d centerV4 = new Vector4d(center.X , center.Y , center.Z , 1f);
Vector3d length = new Vector3d(sphereRadius, 0, 0);
double rad = length.Length();
for (int i = 0; i < 6; i++)
{
if (frustum[i].Dot(centerV4) + rad < 0)
{
return false;
}
}
InViewFrustum = true;
return true;
}
示例3: ProjectedSizeInPixels
// Get the radius in pixels of a sphere with the specified center and radius
// The sphere center should be a point in camera space
private static double ProjectedSizeInPixels(RenderContext11 renderContext, Vector3d center, double radius)
{
Matrix3d projection = renderContext.Projection;
SharpDX.Direct3D11.Viewport viewport = renderContext.ViewPort;
double distance = center.Length();
// Calculate pixelsPerUnit which is the number of pixels covered
// by an object 1 AU at the distance of the planet center from
// the camera. This calculation works regardless of the projection
// type.
double viewportHeight = viewport.Height;
double p11 = projection.M11;
double p34 = projection.M34;
double p44 = projection.M44;
double w = Math.Abs(p34) * distance + p44;
double pixelsPerUnit = (p11 / w) * viewportHeight;
return radius * pixelsPerUnit;
}
示例4: MidPointByLength
public static Vector3d MidPointByLength(Vector3d left, Vector3d right)
{
var result = new Vector3d((left.X + right.X) / 2, (left.Y + right.Y) / 2, (left.Z + right.Z) / 2);
result.Normalize();
result.Multiply(left.Length());
return result;
}