本文整理汇总了C#中TerraViewer.Vector3d类的典型用法代码示例。如果您正苦于以下问题:C# Vector3d类的具体用法?C# Vector3d怎么用?C# Vector3d使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Vector3d类属于TerraViewer命名空间,在下文中一共展示了Vector3d类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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;
}
开发者ID:china-vo,项目名称:wwt-windows-client,代码行数:31,代码来源:Orbit.cs
示例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));
}
开发者ID:china-vo,项目名称:wwt-windows-client,代码行数:12,代码来源:ToastTools.cs
示例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;
}
开发者ID:ngonzalezromero,项目名称:wwt-windows-client,代码行数:15,代码来源:ViewMover.cs
示例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;
}
开发者ID:ngonzalezromero,项目名称:wwt-windows-client,代码行数:40,代码来源:SphericalTile.cs
示例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;
}
开发者ID:china-vo,项目名称:wwt-windows-client,代码行数:86,代码来源:TileCache.cs
示例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;
}
开发者ID:bluephoton,项目名称:wwt-windows-client,代码行数:22,代码来源:MercatorTile.cs
示例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;
}
}
开发者ID:china-vo,项目名称:wwt-windows-client,代码行数:11,代码来源:SkyText.cs
示例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);
}
开发者ID:china-vo,项目名称:wwt-windows-client,代码行数:19,代码来源:Shaders11.cs
示例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;
}
开发者ID:china-vo,项目名称:wwt-windows-client,代码行数:17,代码来源:Glu.cs
示例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;
}
}
开发者ID:bluephoton,项目名称:wwt-windows-client,代码行数:42,代码来源:ObjectProperties.cs
示例11: CallFindClosestObject
private void CallFindClosestObject(Vector3d orig, Vector3d ray)
{
if (invokeFindClosestObject == null)
{
invokeFindClosestObject = Grids.FindClosestObject;
}
invokeFindClosestObject.BeginInvoke(orig, ray, CallBack, null);
}
开发者ID:bluephoton,项目名称:wwt-windows-client,代码行数:9,代码来源:ObjectProperties.cs
示例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();
}
开发者ID:bluephoton,项目名称:wwt-windows-client,代码行数:41,代码来源:ToastTile.cs
示例13: CalcSphere
protected void CalcSphere(Vector3d[] list)
{
ConvexHull.FindEnclosingSphere(list, out sphereCenter, out sphereRadius);
}
开发者ID:bluephoton,项目名称:wwt-windows-client,代码行数:4,代码来源:ToastTile.cs
示例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;
}
开发者ID:bluephoton,项目名称:wwt-windows-client,代码行数:9,代码来源:ToastTile.cs
示例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);
}
开发者ID:bluephoton,项目名称:wwt-windows-client,代码行数:18,代码来源:ToastTile.cs
示例16: Export_Click
private void Export_Click(object sender, EventArgs e)
{
var filename = "";
var saveDialog = new SaveFileDialog();
saveDialog.Filter = "Standard Tessellation Language" + "|*.stl";
saveDialog.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
saveDialog.AddExtension = true;
saveDialog.DefaultExt = ".stl";
if (saveDialog.ShowDialog() == DialogResult.OK)
{
filename = saveDialog.FileName;
if (string.IsNullOrEmpty(filename))
{
return;
}
}
else
{
return;
}
ProgressPopup.Show(this, "Export STL File", "Scanning Elevation Map");
var baseOffset = double.Parse(baseHeight.Text);
density = int.Parse(Density.Text);
var xRate = Rect.West - Rect.East;
var yRate = Rect.North - Rect.South;
var latCenter = (Rect.North + Rect.South) / 2;
var ratio = Math.Cos(latCenter / 180 * Math.PI);
double sizeY = 100;
var sizeX = Math.Abs(((xRate * ratio) / yRate) * sizeY);
var stepsX = (int)(sizeX * density / 10);
var stepsY = (int)(sizeY * density / 10);
//Computer relative altitude to latitude scaling for this planet.
var radius = Earth3d.MainWindow.RenderContext11.NominalRadius;
var altScaleFactor = ((radius * Math.PI * 2) / 360) * (yRate/sizeY);
altScaleFactor = 1 / altScaleFactor;
xRate /= stepsX;
yRate /= stepsY;
var points = new Vector3d[stepsX, stepsY];
var altitude = new double[stepsX, stepsY];
double maxAltitude = -10000000;
double minAltitude = 100000000;
var altScale = double.Parse(AltitudeScale.Text) / 100;
var estimatedTotal = stepsX * stepsY;
var actualTotal = 0;
for (var y = 0; y < stepsY; y++)
{
for (var x = 0; x < stepsX; x++)
{
var lat = Rect.North - (yRate * y);
var lng = Rect.East + (xRate * x);
var alt = Earth3d.MainWindow.GetAltitudeForLatLongNow(lat, lng);
altitude[x, y] = alt;
maxAltitude = Math.Max(alt, maxAltitude);
minAltitude = Math.Min(minAltitude, alt);
actualTotal++;
}
if (!ProgressPopup.SetProgress(((actualTotal * 100) / estimatedTotal), "Scanning Elevation Map"))
{
ProgressPopup.Done();
return;
}
}
var altRange = maxAltitude - minAltitude;
// old altScaleFactor = (10 / altRange) * altScale;
altScaleFactor *= altScale;
var stepScaleX = sizeX / stepsX;
var stepScaleY = sizeY / stepsY;
// make the verticies
for (var y = 0; y < stepsY; y++)
{
for (var x = 0; x < stepsX; x++)
{
altitude[x, y] = ((altitude[x, y] - minAltitude) * altScaleFactor) + baseOffset;
points[x, y] = new Vector3d(x * stepScaleX, y * stepScaleY, altitude[x, y]);
}
//.........这里部分代码省略.........
开发者ID:bluephoton,项目名称:wwt-windows-client,代码行数:101,代码来源:ExportSTL.cs
示例17: MakePosition
public static Vector3d MakePosition(float centerX, float centerY, float offsetX, float offsetY, float angle)
{
Vector3d point = new Vector3d(centerX + offsetX, centerY + offsetY, 1);
return point;
}
开发者ID:china-vo,项目名称:wwt-windows-client,代码行数:6,代码来源:Sprite2d.cs
示例18: IsSphereInFrustum
private static bool IsSphereInFrustum(Vector3d sphereCenter, double sphereRadius, PlaneD[] frustum)
{
Vector4d center4 = new Vector4d(sphereCenter.X, sphereCenter.Y, sphereCenter.Z, 1.0);
for (int i = 0; i < 6; i++)
{
if (frustum[i].Dot(center4) < -sphereRadius)
{
return false;
}
}
return true;
}
开发者ID:ngonzalezromero,项目名称:wwt-windows-client,代码行数:14,代码来源:LayerManager.cs
示例19: IsLeftOfHalfSpace
private bool IsLeftOfHalfSpace(Vector3d pntA, Vector3d pntB, Vector3d pntTest)
{
pntA.Normalize();
pntB.Normalize();
Vector3d cross = Vector3d.Cross(pntA, pntB);
double dot = Vector3d.Dot(cross, pntTest);
return dot > 0;
}
开发者ID:china-vo,项目名称:wwt-windows-client,代码行数:10,代码来源:Glu.cs
示例20: 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;
}
开发者ID:ngonzalezromero,项目名称:wwt-windows-client,代码行数:22,代码来源:LayerManager.cs
注:本文中的TerraViewer.Vector3d类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论