本文整理汇总了C#中Vector2d类的典型用法代码示例。如果您正苦于以下问题:C# Vector2d类的具体用法?C# Vector2d怎么用?C# Vector2d使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Vector2d类属于命名空间,在下文中一共展示了Vector2d类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: LightWeightPolylineVertex
/// <summary>
/// Initializes a new instance of the <c>LightWeightPolylineVertex</c> class.
/// </summary>
public LightWeightPolylineVertex()
{
this.location = Vector2d.Zero;
this.bulge = 0.0f;
this.beginThickness = 0.0f;
this.endThickness = 0.0f;
}
示例2: Rotate
public void Rotate(Vector2d startPoint, Vector2d endPoint)
{
var rotation = CalculateRotation(startPoint, endPoint);
_tempCameraOrientation = rotation.GetRotationMatrix();
FireCameraChanged();
}
示例3: Next
public static Vector2d Next(this Random random, Vector2d min, Vector2d max)
{
return new Vector2d(
min.X + random.NextDouble() * (max.X - min.X),
min.Y + random.NextDouble() * (max.Y - min.Y)
);
}
示例4: Bullet
public Bullet(Vector2d From, Vector2d To, DateTime st)
{
ShootTime = DateTime.Now;
this.From = From;
this.To = To;
this.dir = Vector2d.Normalize(To - From);
}
示例5: LightWeightPolylineVertex
/// <summary>
/// Initializes a new instance of the <c>LightWeightPolylineVertex</c> class.
/// </summary>
/// <param name="location">Lightweight polyline <see cref="netDxf.Vector2d">vertex</see> coordinates.</param>
public LightWeightPolylineVertex(Vector2d location)
{
this.location = location;
this.bulge = 0.0;
this.beginThickness = 0.0f;
this.endThickness = 0.0f;
}
示例6: Vertex
public Vertex(double px, double py, double pz, /*double nx, double ny, double nz,*/ double tcx, double tcy)
{
Position = new Vector3d(px, py, pz);
//Normal = new Vector3d(nx, ny, nz);
TexCoord = new Vector2d(tcx, tcy);
Color = Vector4.One;
}
示例7: TransformToRelative
public Vector2d TransformToRelative(Vector2d absoluteCoordinate)
{
var x = absoluteCoordinate.X / Control.Width * 2 - 1;
var y = (Control.Height - absoluteCoordinate.Y) / Control.Height * 2 - 1;
return new Vector2d(x, y);
}
示例8: Loop
public void Loop(TimeSpan loopTime)
{
foreach (var connection in Graph.Connectivities)
{
var node1 = connection.Node1;
var node2 = connection.Node2;
var distance = Vector2d.GetDistance(node1.Position, node2.Position);
if (distance < 0.1)
{
// Jitter
distance = 0.1;
}
var forceS = Settings.DistanceToForceFct(distance);
forceS *= Settings.ForceFactor;
forceS *= connection.Connectivity;
var dX = Math.Max(0.1, node1.Position.X - node2.Position.X);
var dY = Math.Max(0.1, node1.Position.Y - node2.Position.Y);
Vector2d force = new Vector2d(forceS * dX / distance, forceS * dY / distance);
node1.ForceN.AddTo(force.Negate());
node2.ForceN.AddTo(force);
}
}
示例9: LineDistSq
/*
* Returns the square distance between the given point and the line
* defined by this segment.
*
* @param p a point.
*/
public double LineDistSq(Vector2d p)
{
Vector2d ap = p - a;
double dotprod = ab.Dot(ap);
double projLenSq = dotprod * dotprod / ab.SqrMagnitude();
return ap.SqrMagnitude() - projLenSq;
}
示例10: IsReal
public static bool IsReal(Vector2d v)
{
return !IsNaN(v) && !double.IsPositiveInfinity(v.X) &&
!double.IsNegativeInfinity(v.X) &&
!double.IsPositiveInfinity(v.Y) &&
!double.IsNegativeInfinity(v.Y);
}
示例11: Update
public void Update()
{
double elapsed = (DateTime.Now - st).TotalMilliseconds;
//dir = Vector2d.Normalize(To - From);
//position = From + ((elapsed * Speed) * dir);
position = P.GetPosition(elapsed, Speed);
}
示例12: TransformToRelative
public Vector2d TransformToRelative(Vector2d absoluteCoordinate)
{
var x = absoluteCoordinate.X / Interface.Width * 2 - 1;
var y = (Interface.Height - absoluteCoordinate.Y) / Interface.Height * 2 - 1;
return new Vector2d(x, y);
}
示例13: Vector4d
public Vector4d(Vector2d v, double z, double w)
{
x = v.x;
y = v.y;
this.z = z;
this.w = w;
}
示例14: Rotate
public void Rotate(Vector2d startPoint, Vector2d endPoint)
{
var rotation = CalculateRotation(startPoint, endPoint);
var result = Vector3d.Transform(_camera.Position, rotation);
_camera.Position = result;
}
示例15: Circle
public static void Circle(Vector2d origin, double radius, double currentZoom = 1, int sides = 0, bool loop = false)
{
if (sides < 3)
{
if (radius < 20) sides = 16;
else if (radius < 50) sides = 24;
else if (radius < 100) sides = 42;
else if (radius < 300) sides = 64;
else sides = 128;
}
radius /= currentZoom;
var diff = (2 * Math.PI) / sides;
var last = new Vector2d(0, 0);
for (var i = 0; i < sides; i++)
{
var deg = diff * i;
var point = new Vector2d(origin.X + Math.Cos(deg) * radius, origin.Y + Math.Sin(deg) * radius);
if (i > 0 || loop)
{
if (!loop) GL.Vertex2(last);
GL.Vertex2(point);
}
last = point;
}
if (loop) return;
GL.Vertex2(last);
GL.Vertex2(origin.X + radius, origin.Y);
}