本文整理汇总了C#中TerraViewer.Vector3d.Normalize方法的典型用法代码示例。如果您正苦于以下问题:C# Vector3d.Normalize方法的具体用法?C# Vector3d.Normalize怎么用?C# Vector3d.Normalize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TerraViewer.Vector3d
的用法示例。
在下文中一共展示了Vector3d.Normalize方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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;
}
示例2: 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);
}
示例3: SkyLabel
public SkyLabel(RenderContext11 renderContext, double ra, double dec, string text, LabelSytle style, double distance)
{
RA = ra;
Dec = dec;
Text = text;
Style = style;
Distance = distance;
if (texture == null)
{
texture = Texture11.FromBitmap(Resources.circle, 0);
}
var up = new Vector3d();
var textPos = new Vector3d();
if (Earth3d.MainWindow.SolarSystemMode)
{
pos = Coordinates.RADecTo3d(ra, -dec, distance);
up = Coordinates.RADecTo3d(ra, -dec + 90, distance);
pos.RotateX(Coordinates.MeanObliquityOfEcliptic(SpaceTimeController.JNow) / 180.0 * Math.PI);
pos.Add(Planets.GetPlanet3dLocation(SolarSystemObjects.Earth));
up.RotateX(Coordinates.MeanObliquityOfEcliptic(SpaceTimeController.JNow) / 180.0 * Math.PI);
up.Add(Planets.GetPlanet3dLocation(SolarSystemObjects.Earth));
}
else
{
pos = Coordinates.RADecTo3d(ra+12, dec, distance);
textPos = Coordinates.RADecTo3d(ra + 12, dec + 2, distance);
up = Coordinates.RADecTo3d(ra+12, dec + 92, distance);
}
center = new Vector3(9, 9, 0);
textBatch = new Text3dBatch(24);
if (style == LabelSytle.Telrad)
{
// Telrad-style labels are always screen-aligned
var t3 = new Text3d(new Vector3d(0, 0, 0.1), new Vector3d(0, 1, 0), text, 20, .01);
t3.alignment = Text3d.Alignment.Left;
textBatch.Add(t3);
}
else
{
up.Normalize();
textPos.Normalize();
textBatch.Add(new Text3d(textPos, up, text, 20, .0005));
}
}
示例4: TransformStarPickPointToWorldSpace
public void TransformStarPickPointToWorldSpace(Point ptCursor, int backBufferWidth, int backBufferHeight, out Vector3d vPickRayOrig, out Vector3d vPickRayDir)
{
Vector3d v;
v.X = (((2.0f * ptCursor.X) / backBufferWidth) - 1) / ProjMatrix.M11;
v.Y = -(((2.0f * ptCursor.Y) / backBufferHeight) - 1) / ProjMatrix.M22;
v.Z = 1.0f;
Matrix3d mInit = WorldMatrix * ViewMatrix;
Matrix3d m = Matrix3d.Invert(mInit);
// Transform the screen space pick ray into 3D space
vPickRayDir.X = v.X * m.M11 + v.Y * m.M21 + v.Z * m.M31;
vPickRayDir.Y = v.X * m.M12 + v.Y * m.M22 + v.Z * m.M32;
vPickRayDir.Z = v.X * m.M13 + v.Y * m.M23 + v.Z * m.M33;
vPickRayDir.Normalize();
// Transform the screen space pick ray into 3D space
vPickRayDir.X = v.X * m.M11 + v.Y * m.M21 + v.Z * m.M31;
vPickRayDir.Y = v.X * m.M12 + v.Y * m.M22 + v.Z * m.M32;
vPickRayDir.Z = v.X * m.M13 + v.Y * m.M23 + v.Z * m.M33;
vPickRayDir.Normalize();
vPickRayOrig.X = m.M41;
vPickRayOrig.Y = m.M42;
vPickRayOrig.Z = m.M43;
// Calculate the origin as intersection with near frustum
vPickRayOrig.X += vPickRayDir.X * m_nearPlane;
vPickRayOrig.Y += vPickRayDir.Y * m_nearPlane;
vPickRayOrig.Z += vPickRayDir.Z * m_nearPlane;
}
示例5: TransformPickPointToWorldSpace
public void TransformPickPointToWorldSpace(Point ptCursor, int backBufferWidth, int backBufferHeight, out Vector3d vPickRayOrig, out Vector3d vPickRayDir)
{
// Credit due to the DirectX 9 C++ Pick sample and MVP Robert Dunlop
// Get the pick ray from the mouse position
// Compute the vector of the pick ray in screen space
Vector3d v;
v.X = (((2.0 * (double)ptCursor.X) / (double)backBufferWidth) - 1) / ProjMatrix.M11;
v.Y = -(((2.0 * (double)ptCursor.Y) / backBufferHeight) - 1) / ProjMatrix.M22;
v.Z = 1.0;
//Matrix3d mInit = WorldMatrix * ViewMatrix;
Matrix3d mInit = RenderContext11.WorldBase * ViewMatrix;
Matrix3d m = Matrix3d.Invert(mInit);
// Transform the screen space pick ray into 3D space
vPickRayDir.X = v.X * m.M11 + v.Y * m.M21 + v.Z * m.M31;
vPickRayDir.Y = v.X * m.M12 + v.Y * m.M22 + v.Z * m.M32;
vPickRayDir.Z = v.X * m.M13 + v.Y * m.M23 + v.Z * m.M33;
vPickRayDir.Normalize();
vPickRayOrig.X = m.M41;
vPickRayOrig.Y = m.M42;
vPickRayOrig.Z = m.M43;
}
示例6: 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;
}
示例7: Midpoint
public static Vector3d Midpoint(Vector3d left, Vector3d right)
{
var tmp = new Vector3d(
left.X * (.5) + right.X * .5,
left.Y * (.5) + right.Y * .5,
left.Z * (.5) + right.Z * .5);
tmp.Normalize();
return tmp;
}
示例8: MidPoint
public static Vector3d MidPoint(Vector3d left, Vector3d right)
{
Vector3d result = new Vector3d((left.X + right.X) / 2, (left.Y + right.Y) / 2, (left.Z + right.Z) / 2);
result.Normalize();
return result;
}