本文整理汇总了C#中Point.Set方法的典型用法代码示例。如果您正苦于以下问题:C# Point.Set方法的具体用法?C# Point.Set怎么用?C# Point.Set使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Point
的用法示例。
在下文中一共展示了Point.Set方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnProvideShadowMetrics
public override void OnProvideShadowMetrics(Point size, Point touch)
{
// Nous prenons les dimensions de notre image
int width = View.Width;
int height = View.Height;
// Nous créons les dimensions de l'ombre
_shadow.SetBounds(0, 0, width, height);
size.Set(width, height);
touch.Set(width / 2, height / 2);
}
示例2: ClipLine
public static bool ClipLine(Point a, Point b, int left, int right, int top, int bottom)
{
Point clippedPoint = new Point();
ClipResult res;
res = clipLeftLine(a, b, clippedPoint, left);
switch (res)
{
case ClipResult.A_IN: b.Set(clippedPoint); break;
case ClipResult.B_IN: a.Set(clippedPoint); break;
case ClipResult.BOTH_OUT: return false;
case ClipResult.BOTH_IN: break;
}
res = clipRightLine(a, b, clippedPoint, right);
switch (res)
{
case ClipResult.A_IN: b.Set(clippedPoint); break;
case ClipResult.B_IN: a.Set(clippedPoint); break;
case ClipResult.BOTH_OUT: return false;
case ClipResult.BOTH_IN: break;
}
res = clipTopLine(a, b, clippedPoint, top);
switch (res)
{
case ClipResult.A_IN: b.Set(clippedPoint); break;
case ClipResult.B_IN: a.Set(clippedPoint); break;
case ClipResult.BOTH_OUT: return false;
case ClipResult.BOTH_IN: break;
}
res = clipBottomLine(a, b, clippedPoint, bottom);
switch (res)
{
case ClipResult.A_IN: b.Set(clippedPoint); break;
case ClipResult.B_IN: a.Set(clippedPoint); break;
case ClipResult.BOTH_OUT: return false;
case ClipResult.BOTH_IN: break;
}
return true;
}
示例3: CalcSizeWithMargins
public void CalcSizeWithMargins(Point originalSize, Point result)
{
result.Set(
originalSize.X + Box.Margins.LeftAndRight,
originalSize.Y + Box.Margins.TopAndBottom);
}
示例4: DeTransformPoint
public virtual void DeTransformPoint(Point src, Point dst)
{
dst.Set(src);
}
示例5: TransformPoint
protected virtual void TransformPoint(Point src, Point dst)
{
dst.Set(src);
}
示例6: Move
//.........这里部分代码省略.........
Go(ActionType.Move, to);
return;
}
}
}
}
var ifUseMedikit = IfUseMedikit();
if (ifUseMedikit != null)
{
Go(ActionType.UseMedikit, ifUseMedikit);
return;
}
if (allowHill && IfRequestEnemyDisposition())
{
Go(ActionType.RequestEnemyDisposition);
return;
}
// Группировка
if ((GetTeamRadius() > MaxTeamRadius && self.Id == commander.Id ||
GetTeamRadius() > MaxTeamRadius/2 && self.Id != commander.Id)
&& self.ActionPoints >= GetMoveCost())
{
var bestTurn = new Point(0, 0, Inf);
for (var i = 0; i < Width; i++)
{
for (var j = 0; j < Height; j++)
{
var r = Math.Max(MaxTeamRadius, GetTeamRadius(self.Id, new Point(i, j)));
if (r < bestTurn.profit && r < GetTeamRadius())
{
bestTurn.Set(i, j, r);
}
}
}
if (bestTurn.profit < Inf)
{
var to = GoScouting(bestTurn, PointGoal ?? (BonusGoal ?? bestTurn));
if (to != null)
{
Go(ActionType.Move, to);
return;
}
}
}
Trooper whoseBonus = null;
var ifTeamBonus = IfTeamBonus(ref whoseBonus, AllowTakeBonus);
if (ifTeamBonus != null && BonusGoal == null && map[ifTeamBonus.X, ifTeamBonus.Y] == 0 && !Equal(ifTeamBonus, self))
{
BonusGoal = ifTeamBonus;
MyStrategy.WhoseBonus = whoseBonus.Id;
}
var waitingHelp = false; //allowHill && IfNeedHelp() && self.Type != TrooperType.FieldMedic && GetBestHelper() != null;
var allowNothing = true;
if (!waitingHelp && IsCanMove() && BonusGoal != null && MyStrategy.WhoseBonus == self.Id)
{
if (IsCanUpper())
{
Go(ActionType.RaiseStance);
return;
}
示例7: CreateChildren
/**
* CreateChildren
*
* @param objects
* @param depth
*/
private void CreateChildren(ObjNode objects, int depth)
{
double maxX = OctFaces[MAXX].GetVert(0).GetX();
double minX = OctFaces[MINX].GetVert(0).GetX();
double maxY = OctFaces[MAXY].GetVert(0).GetY();
double minY = OctFaces[MINY].GetVert(0).GetY();
double maxZ = OctFaces[MAXZ].GetVert(0).GetZ();
double minZ = OctFaces[MINZ].GetVert(0).GetZ();
Point midpt = new Point((maxX + minX) / 2.0f, (maxY + minY) / 2.0f, (maxZ + minZ) / 2.0f);
Point max = new Point();
Point min = new Point();
ObjNode currentnode;
int i;
max.Set(maxX, maxY, maxZ);
min.Set(midpt.GetX(), midpt.GetY(), midpt.GetZ());
Child[0] = new OctNode(max, min);
max.Set(maxX, midpt.GetY(), maxZ);
min.Set(midpt.GetX(), minY, midpt.GetZ());
Child[1] = new OctNode(max, min);
max.Set(maxX, midpt.GetY(), midpt.GetZ());
min.Set(midpt.GetX(), minY, minZ);
Child[2] = new OctNode(max, min);
max.Set(maxX, maxY, midpt.GetZ());
min.Set(midpt.GetX(), midpt.GetY(), minZ);
Child[3] = new OctNode(max, min);
max.Set(midpt.GetX(), maxY, maxZ);
min.Set(minX, midpt.GetY(), midpt.GetZ());
Child[4] = new OctNode(max, min);
max.Set(midpt.GetX(), midpt.GetY(), maxZ);
min.Set(minX, minY, midpt.GetZ());
Child[5] = new OctNode(max, min);
max.Set(midpt.GetX(), midpt.GetY(), midpt.GetZ());
min.Set(minX, minY, minZ);
Child[6] = new OctNode(max, min);
max.Set(midpt.GetX(), maxY, midpt.GetZ());
min.Set(minX, midpt.GetY(), minZ);
Child[7] = new OctNode(max, min);
OctNode[] adj = this.Adjacent;
OctNode[] chld = this.Child;
OctNode adj0 = adj[0];
OctNode adj1 = adj[1];
OctNode adj2 = adj[2];
OctNode adj3 = adj[3];
OctNode adj4 = adj[4];
OctNode adj5 = adj[5];
OctNode chld0 = chld[0];
OctNode chld1 = chld[1];
OctNode chld2 = chld[2];
OctNode chld3 = chld[3];
OctNode chld4 = chld[4];
OctNode chld5 = chld[5];
OctNode chld6 = chld[6];
OctNode chld7 = chld[7];
Child[0].FormAdjacent(adj0, adj1, adj2, chld4, chld1, chld3);
Child[1].FormAdjacent(adj0, chld0, adj2, chld5, adj4, chld2);
Child[2].FormAdjacent(adj0, chld3, chld1, chld6, adj4, adj5);
Child[3].FormAdjacent(adj0, adj1, chld0, chld7, chld2, adj5);
Child[4].FormAdjacent(chld0, adj1, adj2, adj3, chld5, chld7);
Child[5].FormAdjacent(chld1, chld4, adj2, adj3, adj4, chld6);
Child[6].FormAdjacent(chld2, chld7, chld5, adj3, adj4, adj5);
Child[7].FormAdjacent(chld3, adj1, chld4, adj3, chld6, adj5);
if(objects != null)
{
currentnode = objects;
}
else
{
currentnode = ObjList;
}
while(currentnode != null)
{
ObjectType currentobj = currentnode.GetObj();
for(i = 0; i < 8; i++)
{
OctNode cc = chld[i];
max = cc.GetFace(0).GetVert(0);
min = cc.GetFace(5).GetVert(3);
if(!((currentobj.GetMin().GetX() > max.GetX()) ||
(currentobj.GetMax().GetX() < min.GetX())))
{
if(!((currentobj.GetMin().GetY() > max.GetY()) ||
(currentobj.GetMax().GetY() < min.GetY())))
{
if(!((currentobj.GetMin().GetZ() > max.GetZ()) ||
(currentobj.GetMax().GetZ() < min.GetZ())))
{
ObjNode newnode = new ObjNode(currentobj, Child[i].GetList());
cc.SetList(newnode);
//.........这里部分代码省略.........
示例8: RenderScene
/**
* RenderScene
*/
public void RenderScene(Canvas canvas, int width, int section, int nsections)
{
Vector view = camera.GetViewDir();
Vector up = camera.GetOrthoUp();
Vector plane = new Vector();
Vector horIncr = new Vector();
Vector vertIncr = new Vector();
double ylen = camera.GetFocalDist() * (double)Math.Tan(0.5f * camera.GetFOV());
double xlen = ylen * canvas.GetWidth() / canvas.GetHeight();
Point upleft = new Point();
Point upright = new Point();
Point lowleft = new Point();
Point basepoint = new Point();
Point current;
Ray eyeRay = new Ray();
int ypixel, xpixel;
RayID = 1;
plane.Cross(view, up);
view.Scale(camera.GetFocalDist());
up.Scale(ylen);
plane.Scale(-xlen);
upleft.FindCorner(view, up, plane, camera.GetPosition());
plane.Negate();
upright.FindCorner(view, up, plane, camera.GetPosition());
up.Negate();
plane.Negate();
lowleft.FindCorner(view, up, plane, camera.GetPosition());
horIncr.Sub(upright, upleft);
horIncr.Scale(horIncr.Length() / ((double)canvas.GetWidth()));
vertIncr.Sub(lowleft, upleft);
vertIncr.Scale(vertIncr.Length() / ((double)canvas.GetHeight()));
basepoint.Set(upleft.GetX() + 0.5f * (horIncr.GetX() + vertIncr.GetX()), upleft.GetY() + 0.5f * (horIncr.GetY() + vertIncr.GetY()),
upleft.GetZ() + 0.5f * (horIncr.GetZ() + vertIncr.GetZ()));
eyeRay.SetOrigin(camera.GetPosition());
int xstart = section * width / nsections;
int xend = xstart + width / nsections;
Console.WriteLine("+" + xstart + " to " + (xend - 1) + " by " + canvas.GetHeight());
for(ypixel = 0; ypixel < canvas.GetHeight(); ypixel++)
{
current = new Point(basepoint);
for(xpixel = 0; xpixel < canvas.GetWidth(); xpixel++)
{
if(xpixel >= xstart && xpixel < xend)
{
Color color = new Color(0.0f, 0.0f, 0.0f);
eyeRay.GetDirection().Sub(current, eyeRay.GetOrigin());
eyeRay.GetDirection().Normalize();
eyeRay.SetID(RayID);
this.RayID = this.RayID + 1;
Shade(octree, eyeRay, color, 1.0f, 0, 0);
canvas.Write(Brightness, xpixel, ypixel, color);
}
current.Add(horIncr);
}
basepoint.Add(vertIncr);
}
Console.WriteLine("-" + xstart + " to " + (xend - 1) + " by " + canvas.GetHeight());
}