本文整理汇总了C#中Vector2D类的典型用法代码示例。如果您正苦于以下问题:C# Vector2D类的具体用法?C# Vector2D怎么用?C# Vector2D使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Vector2D类属于命名空间,在下文中一共展示了Vector2D类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: writeVertex
public static void writeVertex(XmlWriter writer, Vector2D vert)
{
writer.WriteStartElement("vertex");
writer.WriteAttributeString("x", vert.x.ToString());
writer.WriteAttributeString("y", vert.y.ToString());
writer.WriteEndElement();
}
开发者ID:CodeMason,项目名称:LibGDX_DoomBuilder,代码行数:7,代码来源:MapWriter.cs
示例2: Create
public Logo Create()
{
Randomizer random = Randomizer.Current;
Size size = new Size(random.Get(0.02f, 0.08f));
var halfWidth = size.Width / 2f;
var doubleWidth = size.Width * 2f;
Rectangle view = screen.Viewport;
Vector2D position = new Vector2D(random.Get(doubleWidth, view.Width - doubleWidth), view.Bottom - size.Height / 2);
float direction = position.X > 0.5f ? -1 : 1;
if (random.Get(1, 100) >= 30) direction *= -1;
float r = direction > 0
? random.Get(0, view.Width - position.X - doubleWidth)
: random.Get(0, position.X - doubleWidth);
var h = random.Get(0.3f, view.Height - 0.05f);
var angle = Math.Atan((4 * h) / r);
if (angle == 0)
angle = 1.57079f;
var v0 = Math.Sqrt(r * MovingSprite.Gravity / Math.Sin(2 * angle));
var v_x = (float)(v0 * Math.Cos(angle));
var v_y = (float)(v0 * Math.Sin(angle));
v_x *= direction;
var data = new SimplePhysics.Data()
{
Gravity = new Vector2D(0f, MovingSprite.Gravity),
Velocity = new Vector2D(v_x, -v_y),
RotationSpeed = random.Get(10, 50) * direction
};
return new Logo("DeltaEngineLogo", Color.GetRandomBrightColor(), position, size, data);
}
开发者ID:whztt07,项目名称:DeltaEngine,代码行数:29,代码来源:LogoFactory.cs
示例3: DefaultTowerSelectionPanelForTesting
public DefaultTowerSelectionPanelForTesting(Vector2D position, Game game)
{
towerPanel = new Scene();
clickedPosition = position;
this.game = game;
DisplayTowerSelectionPanel();
}
开发者ID:whztt07,项目名称:DeltaEngine,代码行数:7,代码来源:DefaultTowerSelectionPanelForTesting.cs
示例4: SetTouchState
private void SetTouchState(State state, Vector2D position)
{
if (touch == null)
return; //ncrunch: no coverage
touch.SetTouchState(0, state, position);
AdvanceTimeAndUpdateEntities();
}
开发者ID:whztt07,项目名称:DeltaEngine,代码行数:7,代码来源:TouchDragDropTriggerTests.cs
示例5: MouseDown
public override void MouseDown(Vector2D mouseDownPos, EnumMouseButton button)
{
if (mesh == null)
return;
base.MouseDown(mouseDownPos, button);
}
开发者ID:meshdgp,项目名称:MeshDGP,代码行数:7,代码来源:SelectPointTool.cs
示例6: MouseMove
public override void MouseMove(Vector2D mouseMovePos, EnumMouseButton button)
{
base.MouseMove(mouseMovePos,button);
switch (ParameterCurve.Instance.currentCurve)
{
case EnumCurveComplex.FourPointBezier :
curve = ParameterCurve.Instance.CreateFourBezierCurve(mesh);
break;
case EnumCurveComplex.ThreePointBezier:
curve = ParameterCurve.Instance.CreateThreeBezierCurve(mesh);
break;
case EnumCurveComplex.NPointBezier:
curve = ParameterCurve.Instance.CreateNBezierCurve(mesh);
break;
case EnumCurveComplex.FourPointBSpline:
curve = ParameterCurve.Instance.CreateFourPointBSplineCurve(mesh);
break;
case EnumCurveComplex.NPointBSpline:
curve = ParameterCurve.Instance.CreateNBsplineCurve(mesh);
break;
case EnumCurveComplex.NURBS:
curve = ParameterCurve.Instance.CreateNURBS(mesh);
break;
case EnumCurveComplex.NURBSCicle:
curve = ParameterCurve.Instance.CreateNURBSCicle(mesh);
break;
case EnumCurveComplex.NURBSEllipse:
curve = ParameterCurve.Instance.CreateNURBSEllipse(mesh);
break;
}
}
开发者ID:meshdgp,项目名称:MeshDGP,代码行数:33,代码来源:ToolCurveComplex.cs
示例7: SetNewCenter
private void SetNewCenter(Vector2D newCenter)
{
Center = newCenter;
var newLetterArea = DrawArea;
newLetterArea.Left += Dimension * 0.05f;
currentFontText.DrawArea = newLetterArea;
}
开发者ID:whztt07,项目名称:DeltaEngine,代码行数:7,代码来源:CharacterButton.cs
示例8: TransformState
public TransformState(int id, Vector2D value)
{
Blobs = new Spread<Blob>();
PBlobs = new Spread<Blob>();
Reset(id, value);
}
开发者ID:kopffarben,项目名称:PatternTouch,代码行数:7,代码来源:TransformState.cs
示例9: StopTransformation
public void StopTransformation()
{
Blobs.SliceCount = 0;
PDelta = new Vector2D();
Phase = TransformPhase.Idle;
}
开发者ID:kopffarben,项目名称:PatternTouch,代码行数:7,代码来源:TransformState.cs
示例10: MockTouch
public MockTouch()
{
IsAvailable = true;
positions = new Vector2D[2];
positions[0] = Vector2D.Half;
TouchStates = new State[MaxNumberOfTouchIndices];
}
开发者ID:whztt07,项目名称:DeltaEngine,代码行数:7,代码来源:MockTouch.cs
示例11: SellTower
private static void SellTower(Vector2D point)
{
var level = (GameLevel)Level.Current;
if (level == null)
return;
level.SellTower(GameLevelExtensions.GetGridPosition(point));
}
开发者ID:whztt07,项目名称:DeltaEngine,代码行数:7,代码来源:TowerSelectionPanel.cs
示例12: Correspondence
public Correspondence(int BoardIndex, Vector3D World, Vector2D Projection, DateTime Timestamp)
{
this.BoardIndex = BoardIndex;
this.World = World;
this.Projection = Projection;
this.Timestamp = Timestamp;
}
开发者ID:keith06,项目名称:VVVV.Nodes.Mapping.Database,代码行数:7,代码来源:Correspondence.cs
示例13: CreateFontTexts
private static void CreateFontTexts(Vector2D[] centers, Size size)
{
new FontText(Font.Default, "Up", Rectangle.FromCenter(centers[0], size));
new FontText(Font.Default, "Down", Rectangle.FromCenter(centers[1], size));
new FontText(Font.Default, "Left", Rectangle.FromCenter(centers[2], size));
new FontText(Font.Default, "Right", Rectangle.FromCenter(centers[3], size));
}
开发者ID:remy22,项目名称:DeltaEngine,代码行数:7,代码来源:KeyTriggerTests.cs
示例14: Ball
public Ball(Vector2D position, Vector2D size, string id)
: base(5, 0.3, false)
{
initPosition = position;
this.Id = id;
friction = 0.020F;
}
开发者ID:eyes22,项目名称:GameMobileSoccerlight,代码行数:7,代码来源:Ball.cs
示例15: PerformAttack
public override void PerformAttack(AvatarAttack attack, Vector2D position)
{
if (attack == AvatarAttack.PiggyBankCoinMinefield)
SpawnCoinMinefield();
else if (attack == AvatarAttack.PiggyBankPayDay)
BuffAllCreepsToDropMoreGold();
}
开发者ID:whztt07,项目名称:DeltaEngine,代码行数:7,代码来源:PiggyBank.cs
示例16: GetDistance
public override Scalar GetDistance(Vector2D vector)
{
Vector2D.Subtract(ref vector, ref vertexes[0], out vector);
Scalar result;
Vector2D.GetMagnitude(ref vector, out result);
return result;
}
开发者ID:bsvercl,项目名称:physics2d,代码行数:7,代码来源:Particle.cs
示例17: MouseUp
public override void MouseUp(Vector2D mouseUpPos, EnumMouseButton button)
{
//if ((Control.ModifierKeys & Keys.Control) == Keys.Control)
//{
// if (button == EnumMouseButton.Left)
// {
// if ((Control.ModifierKeys & Keys.Shift) != Keys.Shift)
// {
// NonManifoldMesh m =mesh;
// int n = m.VertexCount;
// for (int i = 0; i < n; i++)
// {
// m.VertexFlag[i] = (byte)0;
// }
// }
// SelectRandomPoint();
// }
//}
//if ((Control.ModifierKeys & Keys.Alt) == Keys.Alt)
//{
// NonManifoldMesh m = mesh;
// int n = m.VertexCount;
// for (int i = 0; i < n; i++)
// {
// m.VertexFlag[i] = (byte)0;
// }
//}
//base.MouseUp(mouseUpPos,button);
}
开发者ID:meshdgp,项目名称:MeshDGP,代码行数:34,代码来源:SelectRandomTool.cs
示例18: CheckForSlicing
public void CheckForSlicing(Vector2D start, Vector2D end)
{
if (!sideStatus.HasFlag(Sides.Top) && CheckIfLineIntersectsLine(start, end, DrawArea.TopLeft, DrawArea.TopRight)) sideStatus |= Sides.Top;
if (!sideStatus.HasFlag(Sides.Left) && CheckIfLineIntersectsLine(start, end, DrawArea.TopLeft, DrawArea.BottomLeft)) sideStatus |= Sides.Left;
if (!sideStatus.HasFlag(Sides.Bottom) && CheckIfLineIntersectsLine(start, end, DrawArea.BottomLeft, DrawArea.BottomRight)) sideStatus |= Sides.Bottom;
if (!sideStatus.HasFlag(Sides.Right) && CheckIfLineIntersectsLine(start, end, DrawArea.TopRight, DrawArea.BottomRight)) sideStatus |= Sides.Right;
}
开发者ID:whztt07,项目名称:DeltaEngine,代码行数:7,代码来源:Logo.cs
示例19: FromPolygon
public static MassInfo FromPolygon(Vector2D[] vertexes, Scalar mass)
{
if (vertexes == null) { throw new ArgumentNullException("vertexes"); }
if (vertexes.Length == 0) { throw new ArgumentOutOfRangeException("vertexes"); }
if (vertexes.Length == 1) { return new MassInfo(mass, 0); }
Scalar denom = 0.0f;
Scalar numer = 0.0f;
for (int j = vertexes.Length - 1, i = 0; i < vertexes.Length; j = i, i++)
{
Scalar a, b, c;
Vector2D P0 = vertexes[j];
Vector2D P1 = vertexes[i];
Vector2D.Dot(ref P1, ref P1, out a);
Vector2D.Dot(ref P1, ref P0, out b);
Vector2D.Dot(ref P0, ref P0, out c);
a += b + c;
Vector2D.ZCross(ref P0, ref P1, out b);
b = MathHelper.Abs(b);
denom += (b * a);
numer += b;
}
return new MassInfo(mass, (mass * denom) / (numer * 6));
}
开发者ID:bsvercl,项目名称:physics2d,代码行数:26,代码来源:MassInertia.cs
示例20: Add
public void Add()
{
Vector2D a = new Vector2D(1, 2);
Vector2D b = new Vector2D(3, 1);
Assert.That(a + b, Is.EqualTo(new Vector2D(4, 3)));
Assert.That(a + new Vector2D(2, 2), Is.EqualTo(new Vector2D(3, 4)));
}
开发者ID:BenjaminNitschke,项目名称:PhysicsCourse,代码行数:7,代码来源:Vector2DTests.cs
注:本文中的Vector2D类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论