本文整理汇总了C#中Point.Translate方法的典型用法代码示例。如果您正苦于以下问题:C# Point.Translate方法的具体用法?C# Point.Translate怎么用?C# Point.Translate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Point
的用法示例。
在下文中一共展示了Point.Translate方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: FromCenterAndLenghts
public static Triangle FromCenterAndLenghts(Point center, double l1, double l2, double l3)
{
Point p1 = new Point(0, 0);
Point p2 = new Point(0, l1);
double area = AreaByLenghts(l1, l2, l3);
double height = area * 2 / l1;
double l1bis = Math.Sqrt(Math.Pow(l3, 2) - Math.Pow(height, 2));
Point p3 = new Point(height, l1bis);
Point g = new Triangle(p1, p2, p3).Center();
Vector translation = new Vector(center.X - g.X, center.Y - g.Y);
return new Triangle(
p1.Translate(translation),
p2.Translate(translation),
p3.Translate(translation));
}
示例2: Circle
public Circle(Point center, Distance radius, Direction normalDirection = null)
{
if (normalDirection == null)
{
normalDirection = Direction.Out;
}
var vector1 = new Vector(Point.MakePointWithInches(1, 0, 0)).CrossProduct(normalDirection * new Distance(1, Inches));
var vector2 = new Vector(Point.MakePointWithInches(0, 1, 0)).CrossProduct(normalDirection * new Distance(1, Inches));
var vector3 = new Vector(Point.MakePointWithInches(0, 0, 1)).CrossProduct(normalDirection * new Distance(1, Inches));
var chosen = new List<Vector>() { vector1, vector2, vector3 }.MaxBy(v => v.Magnitude);
var basePoint = center.Translate(chosen.Direction * radius);
var arc = new Arc(basePoint, basePoint, new Line(center, normalDirection));
this._Edges = new List<IEdge>() { arc };
this.NormalLine = new Line(arc.CenterPoint, arc.NormalDirection);
}
示例3: Translate
public void Translate(Point t)
{
Point point = new Point(X, Y, Z);
point.Translate(t);
X = (int)point.X;
Y = (int)point.Y;
Z = (int)point.Z;
}
示例4: StrokeLine
public void StrokeLine(
float lineStartX, float lineStartY, float lineEndX, float lineEndY)
{
Contract.Requires(Thread.CurrentThread == BoundThread);
Contract.Requires(ActiveTarget != null);
Contract.Requires(Check.IsFinite(lineStartX));
Contract.Requires(Check.IsFinite(lineStartY));
Contract.Requires(Check.IsFinite(lineEndX));
Contract.Requires(Check.IsFinite(lineEndY));
if(!_IsTargetEmpty)
{
Point start = new Point(lineStartX, lineStartY);
Point end = new Point(lineEndX, lineEndY);
// translate to 2D surface coordinate space
start = start.Translate(_TargetDelta);
end = end.Translate(_TargetDelta);
OnStrokeLine(ref start, ref end);
}
}
示例5: SetBrush
public void SetBrush(
float radialGradientCenterX,
float radialGradientCenterY,
float radialGradientOffsetWidth,
float radialGradientOffsetHeight,
float radialGradientRadiusWidth,
float radialGradientRadiusHeight,
Gradient gradient)
{
Contract.Requires(Thread.CurrentThread == BoundThread);
Contract.Requires(ActiveTarget != null);
Contract.Requires(Check.IsFinite(radialGradientCenterX));
Contract.Requires(Check.IsFinite(radialGradientCenterY));
Contract.Requires(Check.IsFinite(radialGradientOffsetWidth));
Contract.Requires(Check.IsFinite(radialGradientOffsetHeight));
Contract.Requires(Check.IsPositive(radialGradientRadiusWidth));
Contract.Requires(Check.IsPositive(radialGradientRadiusHeight));
Contract.Requires(gradient != null);
if(!_IsTargetEmpty)
{
Point radialGradientCenter = new Point(
radialGradientCenterX, radialGradientCenterY);
// translate to 2D surface coordinate space
radialGradientCenter = radialGradientCenter.Translate(_TargetDelta);
Size radialGradientOffset = new Size(
radialGradientOffsetWidth, radialGradientOffsetHeight);
Size radialGradientRadius = new Size(
radialGradientRadiusWidth, radialGradientRadiusHeight);
OnSetBrush(
ref radialGradientCenter,
ref radialGradientOffset,
ref radialGradientRadius,
gradient);
}
}