本文整理汇总了C#中TerraViewer.Vector3d类的典型用法代码示例。如果您正苦于以下问题:C# Vector3d类的具体用法?C# Vector3d怎么用?C# Vector3d使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Vector3d类属于TerraViewer命名空间,在下文中一共展示了Vector3d类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DrawEllipse
// Draw an ellipse with the specified semi-major axis and eccentricity. The orbit is drawn over a single period,
// fading from full brightness at the given eccentric anomaly.
//
// In order to match exactly the position at which a planet is drawn, the planet's position at the current time
// must be passed as a parameter. positionNow is in the current coordinate system of the render context, not the
// translated and rotated system of the orbital plane.
public static void DrawEllipse(RenderContext11 renderContext, double semiMajorAxis, double eccentricity, double eccentricAnomaly, Color color, Matrix3d worldMatrix, Vector3d positionNow)
{
if (ellipseShader == null)
{
ellipseShader = new EllipseShader11();
}
if (ellipseVertexBuffer == null)
{
ellipseVertexBuffer = CreateEllipseVertexBuffer( 500);
}
Matrix3d savedWorld = renderContext.World;
renderContext.World = worldMatrix;
renderContext.devContext.InputAssembler.PrimitiveTopology = SharpDX.Direct3D.PrimitiveTopology.LineStrip;
renderContext.SetVertexBuffer(ellipseVertexBuffer);
ellipseShader.UseShader(renderContext, semiMajorAxis, eccentricity, eccentricAnomaly, new SharpDX.Color(color.R, color.G, color.B, color.A), savedWorld, positionNow);
renderContext.devContext.Draw(ellipseVertexBuffer.Count, 0);
renderContext.World = savedWorld;
}
示例2: ToastTools
public ToastTools(ToastTools parent, int level, int x, int y)
{
Parent = parent;
X = x;
Y = y;
Level = level;
InitializeGrids();
TopLeft = new Vector3d(Vector3d.Scale(bounds[0, 0].Position, 1));
BottomRight = new Vector3d(Vector3d.Scale(bounds[2, 2].Position, 1));
TopRight = new Vector3d(Vector3d.Scale(bounds[2, 0].Position, 1));
BottomLeft = new Vector3d(Vector3d.Scale(bounds[0, 2].Position, 1));
}
示例3: CameraParameters
public CameraParameters(double lat, double lng, double zoom, double rotation, double angle, float opactity)
{
Lat = lat;
Lng = lng;
Zoom = zoom;
Rotation = rotation;
Angle = angle;
RaDec = false;
Opacity = opactity;
ViewTarget = new Vector3d(0, 0, 0);
Target = SolarSystemObjects.Custom;
TargetReferenceFrame = "";
DomeAlt = 0;
DomeAz = 0;
}
示例4: CreateGeometry
public override bool CreateGeometry(RenderContext11 renderContext, bool uiThread)
{
if (texture == null)
{
if (this.texture == null)
{
if (TextureReady)
{
texture = BufferPool11.GetTexture(FileName);
double aspect = (double)texture.Width / (double)texture.Height;
if (aspect < 1.5)
{
domeMaster = true;
}
}
else
{
return false;
}
}
iTileBuildCount++;
if (vertexBuffer == null)
{
vertexBuffer = new VertexBuffer11(typeof(PositionNormalTexturedX2), VertexCount, RenderContext11.PrepDevice);
indexBuffer = new IndexBuffer11[4];
OnCreateVertexBuffer(vertexBuffer);
sphereRadius = 1;
sphereCenter = new Vector3d(0, 0, 0);
}
}
ReadyToRender = true;
return true;
}
示例5: 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;
}
示例6: PreCreateGeometry
public override bool PreCreateGeometry(RenderContext11 renderContext)
{
if (Properties.Settings.Default.Show3dCities)
{
// Conditionalsupport for 3d Cities based on settings
dsm = new DSMTile();
var center = new Vector3d();
double radius = 0;
if (dsm != null)
{
texture = dsm.LoadMeshFile(filename, localCenter, out center, out radius);
}
if (texture != null)
{
sphereCenter = center;
sphereRadius = radius;
return true;
}
}
return false;
}
示例7: Text3d
public Text3d(Vector3d center, Vector3d up, string text, float fontsize, double scale)
{
Text = text;
this.up = up;
this.center = center;
this.scale = scale;
if (fontsize < 0)
{
sky = false;
}
}
示例8: UseShader
public static void UseShader(RenderContext11 renderContext, Color color, Matrix3d world, Vector3d positionNow, double timeOffset, double coverageDuration)
{
TimeOffset = (float)timeOffset;
CoverageDuration = (float)coverageDuration;
Color = color;
PositionNow = positionNow;
Matrix matrixWVP = (renderContext.World * renderContext.View * renderContext.Projection).Matrix11;
matrixWVP.Transpose();
MatWVP = matrixWVP;
Matrix positionWVP = (world * renderContext.View * renderContext.Projection).Matrix11;
positionWVP.Transpose();
MatPositionWVP = positionWVP;
Use(renderContext.devContext);
}
示例9: InsideTriangle
private bool InsideTriangle(Vector3d pntA, Vector3d pntB, Vector3d pntC, Vector3d pntTest)
{
if (!IsLeftOfHalfSpace(pntA, pntB, pntTest))
{
return false;
}
if (!IsLeftOfHalfSpace(pntB, pntC, pntTest))
{
return false;
}
if (!IsLeftOfHalfSpace(pntC, pntA, pntTest))
{
return false;
}
return true;
}
示例10: FindCurrentObject
private void FindCurrentObject()
{
var loc = Earth3d.MainWindow.RenderWindow.PointToClient(PointToScreen(new Point(300, 88)));
IPlace closetPlace = null;
var result = new Coordinates(0,0);
if (Earth3d.MainWindow.SolarSystemMode)
{
var pt = loc;
Vector3d PickRayOrig;
Vector3d PickRayDir;
var rect = Earth3d.MainWindow.RenderWindow.ClientRectangle;
Earth3d.MainWindow.TransformStarPickPointToWorldSpace(pt, rect.Width, rect.Height, out PickRayOrig, out PickRayDir);
var temp = new Vector3d(PickRayOrig);
temp.Subtract(Earth3d.MainWindow.viewCamera.ViewTarget);
//closetPlace = Grids.FindClosestObject(temp , new Vector3d(PickRayDir));
CallFindClosestObject(temp, new Vector3d(PickRayDir));
}
else
{
// TODO fix this for earth, plantes, panoramas
result = Earth3d.MainWindow.GetCoordinatesForScreenPoint(loc.X, loc.Y);
var constellation = Earth3d.MainWindow.ConstellationCheck.FindConstellationForPoint(result.RA, result.Dec);
//Place[] resultList = ContextSearch.FindClosestMatches(constellation, result.RA, result.Dec, ZoomFactor / 600, 5);
closetPlace = ContextSearch.FindClosestMatch(constellation, result.RA, result.Dec, Earth3d.MainWindow.DegreesPerPixel * 80);
if (closetPlace == null)
{
// closetPlace = Grids.FindClosestMatch(constellation, result.RA, result.Dec, Earth3d.MainWindow.DegreesPerPixel * 80);
CallFindClosestMatch(constellation, result.RA, result.Dec, Earth3d.MainWindow.DegreesPerPixel * 80);
noPlaceDefault = new TourPlace(Language.GetLocalizedText(90, "No Object"), result.Dec, result.RA, Classification.Unidentified, constellation, ImageSetType.Sky, -1);
//Earth3d.MainWindow.SetLabelText(null, false);
return;
}
Earth3d.MainWindow.SetLabelText(closetPlace, false);
Target = closetPlace;
}
}
示例11: CallFindClosestObject
private void CallFindClosestObject(Vector3d orig, Vector3d ray)
{
if (invokeFindClosestObject == null)
{
invokeFindClosestObject = Grids.FindClosestObject;
}
invokeFindClosestObject.BeginInvoke(orig, ray, CallBack, null);
}
示例12: ComputeBoundingSphere
protected void ComputeBoundingSphere(Tile parent, double altitude)
{
InitializeGrids();
var pointList = BufferPool11.GetVector3dBuffer(vertexList.Count);
var scaleFactor = (1 + (altitude / DemScaleFactor));
if (DemEnabled)
{
for (var i = 0; i < vertexList.Count; i++)
{
pointList[i] = Vector3d.Scale(vertexList[i].Position, scaleFactor);
}
}
else
{
for (var i = 0; i < vertexList.Count; i++)
{
pointList[i] = vertexList[i].Position;
}
}
TopLeft = new Vector3d(Vector3d.Scale(bounds[0, 0].Position, scaleFactor));
BottomRight = new Vector3d(Vector3d.Scale(bounds[2, 2].Position, scaleFactor));
TopRight = new Vector3d(Vector3d.Scale(bounds[2, 0].Position, scaleFactor));
BottomLeft = new Vector3d(Vector3d.Scale(bounds[0, 2].Position, scaleFactor));
CalcSphere(pointList);
BufferPool11.ReturnVector3dBuffer(pointList);
if (Level == 5 || Level == 12)
{
localCenter = sphereCenter;
localCenter.Round();
}
else if (Level > 5)
{
localCenter = parent.localCenter;
}
ReturnBuffers();
}
示例13: CalcSphere
protected void CalcSphere(Vector3d[] list)
{
ConvexHull.FindEnclosingSphere(list, out sphereCenter, out sphereRadius);
}
示例14: LineToPoint
public static double LineToPoint(Vector3d l0, Vector3d l1, Vector3d p)
{
var v = l1 - l0;
var w = p - l0;
var dist = Vector3d.Cross(w, v).Length() / v.Length();
return dist;
}
示例15: GetUVFromInnerPoint
public static Vector2d GetUVFromInnerPoint(Vector3d ul, Vector3d ur, Vector3d ll, Vector3d lr, Vector3d pnt)
{
ul.Normalize();
ur.Normalize();
ll.Normalize();
lr.Normalize();
pnt.Normalize();
var dUpper = LineToPoint(ul, ur, pnt);
var dLower = LineToPoint(ll, lr, pnt);
var dVert = dUpper + dLower;
var dRight = LineToPoint(ur, lr, pnt);
var dLeft = LineToPoint(ul, ll, pnt);
var dHoriz = dRight + dLeft;
return new Vector2d( dLeft/dHoriz, dUpper/dVert);
}