本文整理汇总了C#中Arc类的典型用法代码示例。如果您正苦于以下问题:C# Arc类的具体用法?C# Arc怎么用?C# Arc使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Arc类属于命名空间,在下文中一共展示了Arc类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Main
static void Main(string[] args)
{
Shape myShape = new Line(new Coordinate(0, 0, 0), 10);
myShape.Render();
myShape = new Arc(new Coordinate(1,1,1),5,20);
myShape.Render();
}
示例2: GetPoint
public void GetPoint(string cps, double radius, double offset, double angle, string expected)
{
var centre = cps.AsPoint();
var arc = new Arc(centre, 0, 0, radius, false);
var actual = arc.GetPoint(angle, offset);
Assert.AreEqual(expected, actual.ToString("F0"));
}
示例3: FromDescriptorPoints
/// <summary>
/// Create Arc from 3 given Points
/// </summary>
/// <param name="startPoint">Start-Point of the Arc</param>
/// <param name="interPoint">A point anywhere the Arc</param>
/// <param name="endPoint">End-Point of the Arc</param>
/// <returns></returns>
public static Arc FromDescriptorPoints(Vector2 startPoint, Vector2 interPoint, Vector2 endPoint)
{
const Direction calcdirection = Direction.RIGHT;
// Calculate Rays from the 3 given Points
var rays = RaysFromDescriptorPoints(startPoint, interPoint, endPoint, DirectionUtil.Switch(calcdirection));
// The two Rays intercept in the Arc's Middlepoint:
var arcCenter = rays[0].Intersect(rays[1]);
var arcRadius = new Vector2(startPoint, arcCenter).Length;
// Take Vectors from these Points
var middleToStart = new Vector2(arcCenter, startPoint);
var middleToEnd = new Vector2(arcCenter, endPoint);
// Calculate base vector
var vbase = middleToStart.GetOrthogonalVector(Direction.RIGHT)*-1;
var arcAngle = middleToEnd.AngleSignedTo(middleToStart, true);
var newArc = new Arc(
arcRadius,
arcAngle,
vbase)
{
Location = startPoint,
Direction = DirectionUtil.Switch(calcdirection)
};
return newArc;
}
示例4: ArcView
public ArcView(Arc arc)
{
this.SemanticNetworkId = arc.SemanticNetworkId;
this.Text = arc.Text;
this.ArcId = arc.ArcId;
this.FromVertexId = arc.FromVertexId;
this.ToVertexId = arc.ToVertexId;
}
示例5: InitArcs
private void InitArcs()
{
arcs = new Arc [num_arcs];
arcs [right_answer] = new Arc () { X = 0.35, Y = 0.42, Size = 0.35, StartAngle = 215, EndAngle = 260};
arcs[1] = new Arc () { X = 0.3, Y = 0.40, Size = 0.25, StartAngle = 215, EndAngle = 290};
arcs[2] = new Arc () { X = 0.3, Y = 0.40, Size = 0.25, StartAngle = 215, EndAngle = 270};
arcs[3] = new Arc () { X = 0.3, Y = 0.40, Size = 0.25, StartAngle = 215, EndAngle = 270};
}
示例6: waitForParticles
public IEnumerator waitForParticles()
{
while (particleSystem.GetParticles(particles) < pCount) {
yield return 0;
}
arcs = new Arc[maxConcurrentArcs];
for (int i = 0; i < maxConcurrentArcs; i++) {
arcs[i] = new Arc(particles, particlesPerArc * i, particlesPerArc);
}
running = true;
}
示例7: MakeArea
private static Arc MakeArea(double startAngle, double endAngle, Color fillColor)
{
Arc arc = new Arc();
arc.Stretch = Stretch.None;
arc.Width = 200;
arc.Height = 200;
arc.StartAngle = startAngle;
arc.EndAngle = endAngle;
arc.ArcThickness = 20;
arc.StrokeThickness = 0.5;
arc.Stroke = new SolidColorBrush(Colors.Black);
arc.Fill = new SolidColorBrush(fillColor);
return arc;
}
示例8: IntersectionWith
public PointD[] IntersectionWith(Arc arc)
{
if (arc.Point.DistanceTo(this) > arc.Radius) return null;
double a = Math.Pow(Slope.Value, 2) + 1;
double b = 2 * ((Point.Y * Slope.Value) - (Point.X * Math.Pow(Slope.Value, 2)) - (arc.Point.Y * Slope.Value) - arc.Point.X);
double c = Math.Pow(arc.Point.X, 2) - Math.Pow(arc.Radius, 2) +
(Math.Pow(Point.X, 2)*Math.Pow(Slope.Value, 2)) - (2*Point.X*Point.Y*Slope.Value) +
(2*Point.X*arc.Point.Y*Slope.Value) + Math.Pow(Point.Y, 2) - (2*Point.Y*arc.Point.Y) +
Math.Pow(arc.Point.Y, 2);
double x1 = (-b + Math.Sqrt(b*b - 4*a*c))/(2*a);
double x2 = (-b - Math.Sqrt(b*b - 4*a*c))/(2*a);
return new PointD[] {new PointD(x1, Y(x1).Value), new PointD(x2, Y(x2).Value) };
}
示例9: Main
public static void Main()
{
Coordinate coordinate1, coordinate2;
coordinate1 = new Coordinate(
new Longitude(48, 52), new Latitude(-2, -20));
Arc arc = new Arc(new Longitude(3), new Latitude(1));
coordinate2 = coordinate1 + arc;
Console.WriteLine(coordinate2);
coordinate2 = coordinate2 - arc;
Console.WriteLine(coordinate2);
coordinate2 += arc;
Console.WriteLine(coordinate2);
}
开发者ID:andrewdwalker,项目名称:EssentialCSharp,代码行数:16,代码来源:Listing09.08.CallingTheMinusAndPlusBinaryOperators.cs
示例10: frmMain
public frmMain()
{
InitializeComponent();
Update = Output; //Used to support calling Output() from a different thread.
Angle angle = new Angle(60, AngleType.Degrees);
Line line = new Line(new PointD(0, 0), angle);
Arc arc = new Arc(new PointD(0, 0), 2);
PointD[] intersections = line.IntersectionWith(arc);
foreach (var point in intersections)
{
Output(point.ToString());
}
//tm.Interval = 1000 * 1000;
//tm.MicroTimerElapsed += Tm_MicroTimerElapsed;
//tm.Start();
}
示例11: OnApplyTemplateInternal
internal override void OnApplyTemplateInternal()
{
if (Template != null)
{
_arc = Template.FindName(ArcName, this) as Arc;
if (_arc == null)
{
Trace.TraceWarning(ArcName + " not found.");
}
// NOTE: Lack of contracts: FindName is pure method
Contract.Assume(Template != null);
_busyBar = Template.FindName(BusyBarName, this) as Canvas;
if (_busyBar == null)
{
Trace.TraceWarning(BusyBarName +" not found.");
}
}
base.OnApplyTemplateInternal();
}
示例12: IfcTrimmedCurve
internal IfcTrimmedCurve(DatabaseIfc db, Arc a, bool twoD, IfcCartesianPoint optStrt, out IfcCartesianPoint end)
: base(db)
{
Point3d o = a.Plane.Origin, s = a.StartPoint, e = a.EndPoint;
Vector3d x = s - o;
mSenseAgreement = true;
if (optStrt == null)
optStrt = twoD ? new IfcCartesianPoint(db, new Point2d(s.X, s.Y)) : new IfcCartesianPoint(db, s);
end = twoD ? new IfcCartesianPoint(db, new Point2d(e.X, e.Y)) : new IfcCartesianPoint(db,e);
double angleFactor = mDatabase.mContext.UnitsInContext.getScaleSI(IfcUnitEnum.PLANEANGLEUNIT);
if (twoD)
{
if (a.Plane.ZAxis.Z < 0)
{
mSenseAgreement = false;
x = e - o;
IfcAxis2Placement2D ap = new IfcAxis2Placement2D(db, new Point2d(o.X, o.Y), new Vector2d(x.X, x.Y));
BasisCurve = new IfcCircle(ap, a.Radius);
mTrim1 = new IfcTrimmingSelect(a.Angle / angleFactor, optStrt);
mTrim2 = new IfcTrimmingSelect(0, end);
}
else
{
IfcAxis2Placement2D ap = new IfcAxis2Placement2D(db, new Point2d(o.X, o.Y), new Vector2d(x.X, x.Y));
BasisCurve = new IfcCircle(ap, a.Radius);
mTrim1 = new IfcTrimmingSelect(0, optStrt);
mTrim2 = new IfcTrimmingSelect(a.Angle / angleFactor, end);
}
}
else
{
Vector3d y = Vector3d.CrossProduct(a.Plane.ZAxis, x);
Plane pl = new Plane(o, x, y);
IfcAxis2Placement3D ap = new IfcAxis2Placement3D(db, pl);
BasisCurve = new IfcCircle(ap, a.Radius);
mTrim1 = new IfcTrimmingSelect(0, optStrt);
mTrim2 = new IfcTrimmingSelect(a.Angle / angleFactor, end);
}
mMasterRepresentation = IfcTrimmingPreference.PARAMETER;
}
示例13: ON_Arc_Transform
internal static extern bool ON_Arc_Transform(ref Arc pArc, ref Transform xf);
示例14: ON_Arc_ClosestPointTo
internal static extern bool ON_Arc_ClosestPointTo(ref Arc pArc, Point3d testPoint, ref double t);
示例15: AngularDimension
/// <summary>
/// Create an angular dimension from a give arc
/// </summary>
/// <param name="arc">The start and end points of the arc are the start and endpoints of the dimension</param>
/// <param name="offset">How far to offset the dimension location from the arc</param>
public AngularDimension(Arc arc, double offset)
{
IntPtr ptr = UnsafeNativeMethods.ON_AngularDimension2_New(ref arc, offset);
ConstructNonConstObject(ptr);
}