本文整理汇总了C#中Game.Orig.Math3D.MyVector类的典型用法代码示例。如果您正苦于以下问题:C# MyVector类的具体用法?C# MyVector怎么用?C# MyVector使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
MyVector类属于Game.Orig.Math3D命名空间,在下文中一共展示了MyVector类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: SetPointers
public void SetPointers(MyVector boundryLower, MyVector boundryUpper)
{
_boundryLower = boundryLower;
_boundryUpper = boundryUpper;
// Apply Settings
trkWidth_Scroll(this, new EventArgs());
trkHeight_Scroll(this, new EventArgs());
}
开发者ID:charlierix,项目名称:AsteroidMiner,代码行数:9,代码来源:MapShape.cs
示例2: SolidBallTester
public SolidBallTester()
{
InitializeComponent();
_bitmap = new Bitmap(pictureBox1.DisplayRectangle.Width, pictureBox1.DisplayRectangle.Height);
_graphics = Graphics.FromImage(_bitmap);
_boundryLower = new MyVector(0, 0, 0);
_boundryUpper = new MyVector(pictureBox1.DisplayRectangle.Width, pictureBox1.DisplayRectangle.Height, 0);
}
开发者ID:charlierix,项目名称:AsteroidMiner,代码行数:10,代码来源:SolidBallTester.cs
示例3: button2_Click
private void button2_Click(object sender, EventArgs e)
{
MyVector v1 = new MyVector(1, 0, 0);
MyVector v2 = new MyVector(0, 1, 0);
MyVector rotationAxis;
double radians;
v1.GetAngleAroundAxis(out rotationAxis, out radians, v2);
v2.GetAngleAroundAxis(out rotationAxis, out radians, v1);
}
开发者ID:charlierix,项目名称:AsteroidMiner,代码行数:11,代码来源:VectorTester.cs
示例4: Ball
public Ball(MyVector position, DoubleVector origDirectionFacing, double radius, double mass)
: base(position, origDirectionFacing, radius)
{
// I use the property sets to enforce the values
this.Mass = mass;
this.Elasticity = 1d;
_usesBoundingBox = false;
_boundingLower = null;
_boundingUpper = null;
}
开发者ID:charlierix,项目名称:AsteroidMiner,代码行数:11,代码来源:Ball.cs
示例5: MyQuaternion
/// <summary>
/// This constructs a unit quaternion that represents the rotation
/// </summary>
public MyQuaternion(MyVector rotationAxis, double radians)
{
double halfAngle = radians / 2d;
double sinHalfAngle = Math.Sin(halfAngle);
MyVector rotateAroundUnit = MyVector.BecomeUnitVector(rotationAxis);
// Set my values
this.X = rotateAroundUnit.X * sinHalfAngle;
this.Y = rotateAroundUnit.Y * sinHalfAngle;
this.Z = rotateAroundUnit.Z * sinHalfAngle;
this.W = Math.Cos(halfAngle);
}
开发者ID:charlierix,项目名称:AsteroidMiner,代码行数:15,代码来源:MyQuaternion.cs
示例6: button1_Click
private void button1_Click(object sender, EventArgs e)
{
MyVector v1 = new MyVector(3, 4, 5);
v1.Add(1, 2, 3);
v1.BecomeUnitVector();
MyVector v2 = v1.Clone();
v2.Multiply(3);
v1.Divide(3);
}
开发者ID:charlierix,项目名称:AsteroidMiner,代码行数:14,代码来源:VectorTester.cs
示例7: BallAdder
private Ball _drawingBall = null; // ball is the lowest base class. it could also be solidball or rigidbody
//private double _diminishPercent = 1d;
#endregion
#region Constructor
public BallAdder(LargeMapViewer2D picturebox, ObjectRenderer renderer, BallProps newBallProps, SimpleMap map, MyVector boundryLower, MyVector boundryUpper, List<long> tempObjects)
{
_picturebox = picturebox;
_renderer = renderer;
_newBallProps = newBallProps;
_map = map;
_boundryLower = boundryLower;
_boundryUpper = boundryUpper;
_tempObjects = tempObjects;
_picturebox.MouseDown += new MouseEventHandler(picturebox_MouseDown);
_picturebox.MouseUp += new MouseEventHandler(picturebox_MouseUp);
_picturebox.MouseMove += new MouseEventHandler(picturebox_MouseMove);
}
开发者ID:charlierix,项目名称:AsteroidMiner,代码行数:22,代码来源:BallAdder.cs
示例8: DoGravityDown
private void DoGravityDown()
{
const double ACCELDOWN = .1d;
MyVector accel = new MyVector(0, ACCELDOWN * _gravityMultiplier, 0);
foreach(BallBlip blip in _map.GetAllBlips())
{
if (blip.CollisionStyle != CollisionStyle.Standard)
{
continue;
}
blip.Ball.Acceleration.Add(accel); // I do acceleration instead of force so they all fall at the same rate
}
}
开发者ID:charlierix,项目名称:AsteroidMiner,代码行数:16,代码来源:GravityController.cs
示例9: GravMouse
public GravMouse(LargeMapViewer2D picturebox, SimpleMap map, MyVector boundryLower, MyVector boundryUpper)
{
const double RADIUS = 400;
_picturebox = picturebox;
_map = map;
_boundryLower = boundryLower;
_boundryUpper = boundryUpper;
_cursorBlip = new BallBlip(new Ball(new MyVector(), new DoubleVector(1, 0, 0, 0, 1, 0), RADIUS, UtilityCore.GetMassForRadius(RADIUS, 1d), 1, 0, 0, _boundryLower, _boundryUpper), CollisionStyle.Stationary, RadarBlipQual.BallUserDefined05, TokenGenerator.NextToken());
_picturebox.MouseDown += new MouseEventHandler(picturebox_MouseDown);
_picturebox.MouseUp += new MouseEventHandler(picturebox_MouseUp);
_picturebox.MouseMove += new MouseEventHandler(picturebox_MouseMove);
_picturebox.MouseLeave += new EventHandler(picturebox_MouseLeave);
}
开发者ID:charlierix,项目名称:AsteroidMiner,代码行数:16,代码来源:GravMouse.cs
示例10: Trail
/// <summary>
/// This constructor is meant to assist the clone function
/// </summary>
protected Trail(MyVector[] points, int curPtr, int startRed, int startGreen, int startBlue, int endRed, int endGreen, int endBlue)
{
// Store stuff passed in
_points = points;
_curPtr = curPtr;
_startRed = startRed;
_startGreen = startGreen;
_startBlue = startBlue;
_endRed = endRed;
_endGreen = endGreen;
_endBlue = endBlue;
// Set up the other misc stuff
_isInitialized = true;
}
开发者ID:charlierix,项目名称:AsteroidMiner,代码行数:20,代码来源:Trail.cs
示例11: VectorField2D
public VectorField2D(VectorField2DMode fieldMode, double sizeX, double sizeY, int squaresPerSideX, int squaresPerSideY, double strength, MyVector position)
{
// I use the property sets to enforce constraints
this.FieldMode = fieldMode;
this.SizeX = sizeX;
this.SizeY = sizeY;
this.SquaresPerSideX = squaresPerSideX;
this.SquaresPerSideY = squaresPerSideY;
this.Strength = strength;
// By waiting until now to set the position, I've kept ResetField from running (called by the property sets)
_position = position;
ResetField();
}
开发者ID:charlierix,项目名称:AsteroidMiner,代码行数:18,代码来源:VectorField2D.cs
示例12: FillPie
public void FillPie(Brush brush, MyVector centerPoint, double radius, MyVector centerLine, double sweepRadians)
{
// Turn the centerline and sweep radians into angles that GDI likes
MyVector dummy = new MyVector(1, 0, 0);
double startDegrees;
dummy.GetAngleAroundAxis(out dummy, out startDegrees, centerLine);
startDegrees = Utility3D.GetRadiansToDegrees(startDegrees);
if (centerLine.Y < 0)
{
startDegrees *= -1;
}
double sweepDegrees = Utility3D.GetRadiansToDegrees(sweepRadians);
startDegrees -= sweepDegrees / 2d;
// Call my overload
FillPie(brush, centerPoint, radius, startDegrees, sweepDegrees);
}
开发者ID:charlierix,项目名称:AsteroidMiner,代码行数:20,代码来源:LargeMapViewer2D.cs
示例13: FillRectangle
public void FillRectangle(Brush brush, MyVector lower, MyVector upper)
{
try
{
_graphics.FillRectangle(brush,
PosWToV_X(lower.X), PosWToV_Y(lower.Y),
DistWToV(upper.X - lower.X), DistWToV(upper.Y - lower.Y));
}
catch (OverflowException)
{
// Oh well
}
}
开发者ID:charlierix,项目名称:AsteroidMiner,代码行数:13,代码来源:LargeMapViewer2D.cs
示例14: FillCircle
public void FillCircle(Brush brush, MyVector centerPoint, double radius)
{
try
{
float widthAndHeight = DistWToV(radius * 2d);
_graphics.FillEllipse(brush,
PosWToV_X(centerPoint.X - radius), PosWToV_Y(centerPoint.Y - radius),
widthAndHeight, widthAndHeight);
}
catch (OverflowException)
{
// Oh well
}
}
开发者ID:charlierix,项目名称:AsteroidMiner,代码行数:15,代码来源:LargeMapViewer2D.cs
示例15: LargeMapViewer2D
public LargeMapViewer2D()
{
InitializeComponent();
// Default to viewing everything
_centerPoint = new MyVector();
ZoomFit();
// AutoScroll Emulator
_autoscroll = new AutoScrollEmulator();
_autoscroll.AutoScroll += new AutoScrollHandler(Autoscroll_AutoScroll);
_autoscroll.CursorChanged += new EventHandler(Autoscroll_CursorChanged);
}
开发者ID:charlierix,项目名称:AsteroidMiner,代码行数:13,代码来源:LargeMapViewer2D.cs
示例16: FillTriangle
public void FillTriangle(Brush brush, MyVector point1, MyVector point2, MyVector point3)
{
try
{
PointF[] points = new PointF[3];
points[0].X = PosWToV_X(point1.X);
points[0].Y = PosWToV_Y(point1.Y);
points[1].X = PosWToV_X(point2.X);
points[1].Y = PosWToV_Y(point2.Y);
points[2].X = PosWToV_X(point3.X);
points[2].Y = PosWToV_Y(point3.Y);
_graphics.FillPolygon(brush, points);
}
catch (OverflowException)
{
// Oh well
}
}
开发者ID:charlierix,项目名称:AsteroidMiner,代码行数:22,代码来源:LargeMapViewer2D.cs
示例17: FillPolygon
public void FillPolygon(Brush brush1, Brush brush2, MyVector centerPoint, IMyPolygon polygon)
{
try
{
//TODO: sort the triangles by z
// Children
if (polygon.ChildPolygons != null)
{
foreach (IMyPolygon childPoly in polygon.ChildPolygons)
{
FillPolygon(brush1, brush2, centerPoint, childPoly);
}
}
// Current
if (polygon.Triangles != null)
{
Triangle[] cachedTriangles = polygon.Triangles;
for (int triangleCntr = 0; triangleCntr < cachedTriangles.Length; triangleCntr++)
{
PointF[] points = new PointF[3];
points[0].X = PosWToV_X(cachedTriangles[triangleCntr].Vertex1.X + centerPoint.X);
points[0].Y = PosWToV_Y(cachedTriangles[triangleCntr].Vertex1.Y + centerPoint.Y);
points[1].X = PosWToV_X(cachedTriangles[triangleCntr].Vertex2.X + centerPoint.X);
points[1].Y = PosWToV_Y(cachedTriangles[triangleCntr].Vertex2.Y + centerPoint.Y);
points[2].X = PosWToV_X(cachedTriangles[triangleCntr].Vertex3.X + centerPoint.X);
points[2].Y = PosWToV_Y(cachedTriangles[triangleCntr].Vertex3.Y + centerPoint.Y);
if (triangleCntr % 2 == 0)
{
_graphics.FillPolygon(brush1, points);
}
else
{
_graphics.FillPolygon(brush2, points);
}
}
}
}
catch (OverflowException)
{
// Oh well
}
}
开发者ID:charlierix,项目名称:AsteroidMiner,代码行数:49,代码来源:LargeMapViewer2D.cs
示例18: DrawTriangle_Selected
public void DrawTriangle_Selected(MyVector point1, MyVector point2, MyVector point3)
{
try
{
float x1 = PosWToV_X(point1.X);
float y1 = PosWToV_Y(point1.Y);
float x2 = PosWToV_X(point2.X);
float y2 = PosWToV_Y(point2.Y);
float x3 = PosWToV_X(point3.X);
float y3 = PosWToV_Y(point3.Y);
_graphics.DrawLine(_selectionPen, x1, y1, x2, y2);
_graphics.DrawLine(_selectionPen, x2, y2, x3, y3);
_graphics.DrawLine(_selectionPen, x3, y3, x1, y1);
}
catch (OverflowException)
{
// Oh well
}
}
开发者ID:charlierix,项目名称:AsteroidMiner,代码行数:20,代码来源:LargeMapViewer2D.cs
示例19: DrawArc
public void DrawArc(Color penColor, double penWidth, MyVector[] points, bool closed)
{
try
{
using (Pen pen = new Pen(penColor, DistWToV(penWidth)))
{
// Transform the points to view coords
PointF[] scaledPoints = new PointF[points.Length];
for (int cntr = 0; cntr < points.Length; cntr++)
{
scaledPoints[cntr] = new PointF(PosWToV_X(points[cntr].X), PosWToV_Y(points[cntr].Y));
}
// Draw the curve
if (closed)
{
_graphics.DrawClosedCurve(pen, scaledPoints);
}
else
{
_graphics.DrawCurve(pen, scaledPoints);
}
}
}
catch (OverflowException)
{
// Oh well
}
}
开发者ID:charlierix,项目名称:AsteroidMiner,代码行数:29,代码来源:LargeMapViewer2D.cs
示例20: DrawArc_Selected
public void DrawArc_Selected(MyVector[] points, bool closed)
{
try
{
// Transform the points to view coords
PointF[] scaledPoints = new PointF[points.Length];
for (int cntr = 0; cntr < points.Length; cntr++)
{
scaledPoints[cntr] = new PointF(PosWToV_X(points[cntr].X), PosWToV_Y(points[cntr].Y));
}
// Draw the curve
if (closed)
{
_graphics.DrawClosedCurve(_selectionPen, scaledPoints);
}
else
{
_graphics.DrawCurve(_selectionPen, scaledPoints);
}
}
catch (OverflowException)
{
// Oh well
}
}
开发者ID:charlierix,项目名称:AsteroidMiner,代码行数:26,代码来源:LargeMapViewer2D.cs
注:本文中的Game.Orig.Math3D.MyVector类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论