本文整理汇总了C#中Loon.Core.Geom.Vector2f类的典型用法代码示例。如果您正苦于以下问题:C# Vector2f类的具体用法?C# Vector2f怎么用?C# Vector2f使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Vector2f类属于Loon.Core.Geom命名空间,在下文中一共展示了Vector2f类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ElasticForce
public static Vector2f ElasticForce(Vector2f displacement,
float forceConstant) {
float forceX = -forceConstant * displacement.GetX();
float forceY = -forceConstant * displacement.GetY();
Vector2f theForce = new Vector2f(forceX, forceY);
return theForce;
}
示例2: Line
public Line(Vector2f start_0, Vector2f end_1)
: base()
{
this.loc = new Vector2f(0, 0);
this.closest = new Vector2f(0, 0);
Set(start_0, end_1);
}
示例3: GetVelocity
public static Vector2f GetVelocity(Vector2f velocity, Vector2f force,
float mass) {
Vector2f acceleration = new Vector2f(force.GetX() / mass, force.GetY()
/ mass);
velocity.Add(acceleration);
return velocity;
}
示例4: PConcavePolygonShape
public PConcavePolygonShape(float[] xvers, float[] yvers, float density) {
fig = new PFigure();
tri = new PTriangulator();
poly = new PPolygonizer();
numVertices = xvers.Length;
localVers = new Vector2f[numVertices];
vers = new Vector2f[numVertices];
_dens = density;
for (int i = 0; i < numVertices; i++) {
localVers[i] = new Vector2f(xvers[i], yvers[i]);
vers[i] = new Vector2f(xvers[i], yvers[i]);
}
fig.Figure(localVers, numVertices);
numVertices = fig.numVertices;
localVers = new Vector2f[numVertices];
vers = new Vector2f[numVertices];
for (int i_0 = 0; i_0 < numVertices; i_0++) {
localVers[i_0] = new Vector2f(fig.done[i_0].x, fig.done[i_0].y);
vers[i_0] = new Vector2f(fig.done[i_0].x, fig.done[i_0].y);
}
tri.Triangulate(fig.done, fig.numVertices);
poly.Polygonize(tri.triangles, tri.numTriangles);
convexes = new PConvexPolygonShape[1024];
for (int i_1 = 0; i_1 < poly.numPolygons; i_1++) {
convexes[i_1] = new PConvexPolygonShape(poly.polygons[i_1].xs,
poly.polygons[i_1].ys, _dens);
}
numConvexes = poly.numPolygons;
CalcMassData();
_type = PShapeType.CONCAVE_SHAPE;
}
示例5: Action
public static LNScaleTo Action(float duration, Vector2f s) {
LNScaleTo to = new LNScaleTo();
to._duration = duration;
to._endX = s.x;
to._endY = s.y;
return to;
}
示例6: Line
public Line(float[] start_0, float[] end_1):base() {
this.loc = new Vector2f(0, 0);
this.closest = new Vector2f(0, 0);
this.type = ShapeType.LINE_SHAPE;
Set(start_0, end_1);
}
示例7: LObjectCamera
public LObjectCamera(RectBox r, object f, int width, int height,
int horBorderPixel_0, int vertBorderPixel_1, Vector2f maxSpeed_2)
{
this.cameraX = 0;
this.cameraY = 0;
this.renderWidth = width;
this.renderHeight = height;
this.follow = new Bind(f);
this.horBorderPixel = horBorderPixel_0;
this.vertBorderPixel = vertBorderPixel_1;
this.maxSpeed = maxSpeed_2;
if (follow != null)
{
this.cameraX = follow.GetX() - (this.renderWidth / 2);
this.cameraY = follow.GetY() - (this.renderHeight / 2);
}
this.cameraRect = r;
this.visibleRect = new RectBox(cameraX - horBorderPixel_0, cameraY
- vertBorderPixel_1, renderWidth + horBorderPixel_0, renderHeight
+ vertBorderPixel_1);
this.moveRect = new RectBox(cameraX - horBorderPixel_0, cameraY
- vertBorderPixel_1, renderWidth + horBorderPixel_0, renderHeight
+ vertBorderPixel_1);
this.UpdateCamera();
}
示例8: PPhysManager
public PPhysManager(float s, float gx, float gy) {
this.world = new PPhysWorld();
this.gravity = new Vector2f(gx, gy);
this.start = false;
this.enableGravity = true;
this.scale = s;
}
示例9: ClipEdge
private PPolygonPolygonCollider.PWContactedVertex [] ClipEdge(PPolygonPolygonCollider.PWContactedVertex [] clips,
Vector2f normal, float dist) {
PPolygonPolygonCollider.PWContactedVertex [] line = new PPolygonPolygonCollider.PWContactedVertex [2];
int numClips = 0;
float dist0 = normal.Dot(clips[0].v) - dist;
float dist1 = normal.Dot(clips[1].v) - dist;
if (dist0 < 0.0F) {
line[numClips] = clips[0];
numClips++;
}
if (dist1 < 0.0F) {
line[numClips] = clips[1];
numClips++;
}
if (numClips == 0)
return null;
if (numClips == 2)
return line;
int c = 0;
if (dist0 < 0.0F && dist1 > 0.0F)
c = 1;
float d = dist0 / (dist0 - dist1);
line[1] = new PPolygonPolygonCollider.PWContactedVertex ();
line[1].v = clips[1].v.Sub(clips[0].v).Clone();
line[1].v.MulLocal(d);
line[1].v.AddLocal(clips[0].v);
line[1].data = clips[c].data;
return line;
}
示例10: CreateOrigin
private static Vector2f CreateOrigin(LObject o, Origin origin) {
Vector2f v = new Vector2f(o.X(), o.Y());
switch (origin) {
case Origin.CENTER:
v.Set(o.GetWidth() / 2f, o.GetHeight() / 2f);
return v;
case Origin.TOP_LEFT:
v.Set(0.0f, o.GetHeight());
return v;
case Origin.TOP_RIGHT:
v.Set(o.GetWidth(), o.GetHeight());
return v;
case Origin.BOTTOM_LEFT:
v.Set(0.0f, 0.0f);
return v;
case Origin.BOTTOM_RIGHT:
v.Set(o.GetWidth(), 0.0f);
return v;
case Origin.LEFT_CENTER:
v.Set(0.0f, o.GetHeight() / 2f);
return v;
case Origin.TOP_CENTER:
v.Set(o.GetWidth() / 2f, o.GetHeight());
return v;
case Origin.BOTTOM_CENTER:
v.Set(o.GetWidth() / 2f, 0.0f);
return v;
case Origin.RIGHT_CENTER:
v.Set(o.GetWidth(), o.GetHeight() / 2f);
return v;
default:
return v;
}
}
示例11: GetVelocity
public static Vector2f GetVelocity(Vector2f velocity, List<Vector2f> forces)
{
foreach (Vector2f v in forces)
{
velocity.Add(v);
}
return velocity;
}
示例12: Line
public Line(Vector2f start_0, Vector2f end_1)
: base()
{
this.loc = new Vector2f(0, 0);
this.closest = new Vector2f(0, 0);
this.type = Loon.Core.Geom.ShapeType.LINE_SHAPE;
Set(start_0, end_1);
}
示例13: Action
public static LNJumpParabolaBy Action(float duration, Vector2f position,
Vector2f refPoint) {
LNJumpParabolaBy by = new LNJumpParabolaBy();
by._delta = position;
by._duration = duration;
by._refPoint = refPoint;
return by;
}
示例14: CalculateVector
public static Vector2f CalculateVector(float angle, float magnitude) {
Vector2f v = new Vector2f();
v.x = MathUtils.Sin(MathUtils.ToRadians(angle));
v.x *= magnitude;
v.y = -MathUtils.Cos(MathUtils.ToRadians(angle));
v.y *= magnitude;
return v;
}
示例15: Action
new public static LNMoveBy Action(float duration, Vector2f pos)
{
LNMoveBy by = new LNMoveBy();
by._diff = pos;
by._duration = duration;
by._lastTime = 0f;
return by;
}