本文整理汇总了C#中Vector3D.MagSquared方法的典型用法代码示例。如果您正苦于以下问题:C# Vector3D.MagSquared方法的具体用法?C# Vector3D.MagSquared怎么用?C# Vector3D.MagSquared使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Vector3D
的用法示例。
在下文中一共展示了Vector3D.MagSquared方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DistancePointPlane
public static double DistancePointPlane( Vector3D normalVector, Vector3D planePoint, Vector3D point )
{
// Check to make sure that plane is not degenerate.
if( Tolerance.Zero( normalVector.MagSquared() ) )
return double.NaN;
// Here is the distance (signed depending on which side of the plane we are on).
return ( point - planePoint ).Dot( normalVector ) / normalVector.Abs();
}
示例2: DistancePointLine
public static double DistancePointLine( Vector3D n1, Vector3D p1, Vector3D point )
{
// Check to make sure that n1 is not degenerate.
if( Tolerance.Zero( n1.MagSquared() ) )
return double.NaN;
// ZZZ - Can we make this a signed distance?
return ( ( point - p1 ).Cross( n1 ) ).Abs() / n1.Abs();
}
示例3: PlaneToSphere
/// <summary>
/// Sphere geometry is implicit. A radius 1 sphere with the center at the origin.
/// </summary>
public static Vector3D PlaneToSphere( Vector3D planePoint )
{
planePoint.Z = 0; // Just to be safe.
double magSquared = planePoint.MagSquared();
Vector3D result = new Vector3D(
2 * planePoint.X / ( 1.0 + magSquared ),
2 * planePoint.Y / ( 1.0 + magSquared ),
( magSquared - 1.0 ) / ( magSquared + 1.0 ) );
return result;
}
示例4: DistanceLineLine
public static double DistanceLineLine( Vector3D n1, Vector3D p1, Vector3D n2, Vector3D p2 )
{
// Check to make sure that neither of the normal vectors are degenerate.
if( Tolerance.Zero( n1.MagSquared() ) || Tolerance.Zero( n2.MagSquared() ) )
return double.NaN;
Vector3D plane = n1.Cross( n2 );
// Case where the lines are parallel (magnitude of the cross product will be 0).
if( Tolerance.Zero( plane.MagSquared() ) )
return DistancePointLine( n1, p1, p2 );
return DistancePointPlane( plane, p1, p2 );
}
示例5: DivideQuat
private Vector3D DivideQuat( Vector3D a, Vector3D b )
{
double magSquared = b.MagSquared();
Vector3D bInv = new Vector3D( b.X / magSquared, -b.Y / magSquared, -b.Z / magSquared, -b.W / magSquared );
return MultQuat( a, bInv );
}
示例6: HDist
/// <summary>
/// Returns the hyperbolic distance between two points.
/// </summary>
public static double HDist( Vector3D u, Vector3D v )
{
double isometricInvariant = 2 * ( u - v ).MagSquared() / ( ( 1.0 - u.MagSquared() ) * ( 1.0 - v.MagSquared() ) );
return DonHatch.acosh( 1 + isometricInvariant );
}
示例7: Geodesic
public static void Geodesic( Vector3D v1, Vector3D v2, out Vector3D center, out double radius, out Vector3D normal, out double angleTot )
{
bool finite = !Tolerance.Equal( v1.MagSquared(), 1 ) || !Tolerance.Equal( v2.MagSquared(), 1 );
if( finite )
{
Circle3D c;
H3Models.Ball.OrthogonalCircleInterior( v1, v2, out c );
center = c.Center;
radius = c.Radius;
}
else
H3Models.Ball.OrthogonalCircle( v1, v2, out center, out radius );
Vector3D t1 = v1 - center;
Vector3D t2 = v2 - center;
t1.Normalize(); // This was necessary so that the cross product below didn't get too small.
t2.Normalize();
normal = ( t1 ).Cross( t2 );
normal.Normalize();
angleTot = ( t1 ).AngleTo( t2 );
}