本文整理汇总了C#中ICurve类的典型用法代码示例。如果您正苦于以下问题:C# ICurve类的具体用法?C# ICurve怎么用?C# ICurve使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ICurve类属于命名空间,在下文中一共展示了ICurve类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: HermiteCurveEvaluator
/// <summary>
/// Default constructor</summary>
/// <param name="curve">Curve for which evaluator created</param>
public HermiteCurveEvaluator(ICurve curve)
{
if (curve == null)
throw new ArgumentNullException("curve");
m_curve = curve;
Reset();
}
示例2: TangentsAroundCurve
static IEnumerable<CurveTangent> TangentsAroundCurve(ICurve iCurve) {
Curve c = iCurve as Curve;
if (c != null) {
foreach (ICurve seg in c.Segments)
foreach (CurveTangent ct in TangentsAroundCurve(seg))
yield return ct;
} else {
LineSegment ls = iCurve as LineSegment;
if (ls != null)
yield return new CurveTangent(ls.Start, ls.Derivative(0));
else {
Ellipse ellipse = iCurve as Ellipse;
if (ellipse != null) {
foreach (CurveTangent ct in TangentsOfEllipse(ellipse))
yield return ct;
} else {
CubicBezierSegment bez = iCurve as CubicBezierSegment;
if (bez != null)
foreach (CurveTangent ct in TangentsOfBezier(bez))
yield return ct;
}
}
}
}
示例3: Flatten
/// <summary>
/// Flattens the specified curve. See <see cref="ICurve{TParam, TPoint}.Flatten"/>.
/// </summary>
/// <remarks>
/// This method cannot be used for curves that contain gaps!
/// </remarks>
internal static void Flatten(ICurve<float, Vector3F> curve, ICollection<Vector3F> points, int maxNumberOfIterations, float tolerance)
{
if (tolerance <= 0)
throw new ArgumentOutOfRangeException("tolerance", "The tolerance must be greater than zero.");
float totalLength = curve.GetLength(0, 1, maxNumberOfIterations, tolerance);
// No line segments if the curve has zero length.
if (totalLength == 0)
return;
// A single line segment if the curve's length is less than the tolerance.
if (totalLength < tolerance)
{
points.Add(curve.GetPoint(0));
points.Add(curve.GetPoint(1));
return;
}
var list = ResourcePools<Vector3F>.Lists.Obtain();
Flatten(curve, list, 0, 1, curve.GetPoint(0), curve.GetPoint(1), 0, totalLength, 1, maxNumberOfIterations, tolerance);
foreach (var point in list)
points.Add(point);
ResourcePools<Vector3F>.Lists.Recycle(list);
}
示例4: WithinEpsilon
static bool WithinEpsilon(ICurve bc, double start, double end) {
int n = 3; //hack !!!!
double d = (end - start)/n;
P2 s = bc[start];
P2 e = bc[end];
return DistToSegm(bc[start + d], s, e) < epsilon && DistToSegm(bc[start + d*(n - 1)], s, e) < epsilon;
}
示例5: OffsetCurve
/// <summary>
/// Offsets curve</summary>
/// <param name="curve">Curve</param>
/// <param name="x">X offset</param>
/// <param name="y">Y offset</param>
public static void OffsetCurve(ICurve curve, float x, float y)
{
foreach (IControlPoint cpt in curve.ControlPoints)
{
cpt.X += x;
cpt.Y += y;
}
}
示例6: PolylineAroundClosedCurve
public static Polyline PolylineAroundClosedCurve(ICurve curve) {
Polyline poly = new Polyline();
foreach (Point point in PointsOnAroundPolyline(curve))
poly.AddPoint(point);
if (Point.GetTriangleOrientation(poly.StartPoint.Point, poly.StartPoint.Next.Point, poly.StartPoint.Next.Next.Point) == TriangleOrientation.Counterclockwise)
poly = (Polyline)poly.Reverse();
poly.Closed = true;
return poly;
}
示例7: WeierstrassCurvePoint
public WeierstrassCurvePoint(FiniteFieldElement x, FiniteFieldElement y, ICurve curve)
{
if (!(curve is WeierstrassCurve))
throw new ArgumentException("A weierstrass curve point should only be placed on a weierstrass curve, but was placed on " + curve + ".", "curve");
_x = x;
_y = y;
_curve = curve as WeierstrassCurve;
}
示例8: Rail
internal Rail(ICurve curveSegment, LgEdgeInfo topRankedEdgeInfoOfTheRail, int zoomLevel)
#if DEBUG
: this()
#endif
{
TopRankedEdgeInfoOfTheRail = topRankedEdgeInfoOfTheRail;
this.ZoomLevel = zoomLevel;
Geometry = curveSegment;
}
示例9: BundleBase
/// <summary>
/// constructor
/// </summary>
internal BundleBase(int count, ICurve boundaryCurve, Point position, bool belongsToRealNode, int stationIndex) {
BelongsToRealNode = belongsToRealNode;
Curve = boundaryCurve;
Position = position;
this.stationIndex = stationIndex;
points = new Point[count];
tangents = new Point[count];
OrientedHubSegments = new OrientedHubSegment[count];
ParameterSpan = Curve.ParEnd - Curve.ParStart;
}
示例10: PortEntryOnCurve
public PortEntryOnCurve(ICurve entryCurve, IEnumerable<Tuple<double, double>> parameterSpans) {
EntryCurve = entryCurve;
#if TEST_MSAGL
var polyline = entryCurve as Polyline;
curveIsClosed = (polyline != null) ? polyline.Closed : ApproximateComparer.Close(EntryCurve.Start, EntryCurve.End);
#endif
Spans = parameterSpans;
#if TEST_MSAGL
TestSpans(entryCurve, parameterSpans, curveIsClosed);
#endif
}
示例11: CreateCurveEvaluator
/// <summary>
/// Creates a curve evaluator for a curve</summary>
/// <param name="curve">Curve</param>
/// <returns>Curve evaluator</returns>
/// <remarks>A curve evaluator calculates y-coordinates from x-coordinates using appropriate interpolation for a curve</remarks>
public static ICurveEvaluator CreateCurveEvaluator(ICurve curve)
{
ICurveEvaluator cv = null;
if (curve.CurveInterpolation == InterpolationTypes.Linear)
cv = new LinearCurveEvaluator(curve);
else if (curve.CurveInterpolation == InterpolationTypes.Hermite)
cv = new HermiteCurveEvaluator(curve);
else
throw new NotImplementedException("CurveEvaluator not implement for "
+ curve.CurveInterpolation);
return cv;
}
示例12: KinectPilotProcessor
/// <summary>
/// Constructor
/// </summary>
/// <param name="steeringCurve">Steering curve</param>
/// <param name="pushCurve">Push amount curve</param>
/// <param name="elevationCurve">Elevation curve</param>
public KinectPilotProcessor(ICurve steeringCurve, ICurve pushCurve, ICurve elevationCurve)
{
if (steeringCurve == null)
throw new ArgumentNullException("steeringCurve");
if (pushCurve == null)
throw new ArgumentNullException("pushCurve");
if (elevationCurve == null)
throw new ArgumentNullException("elevationCurve");
this.steeringCurve = steeringCurve;
this.pushCurve = pushCurve;
this.elevationCurve = elevationCurve;
}
示例13: IntersectionInfo
internal IntersectionInfo(double pr0, double pr1, Point x, ICurve s0, ICurve s1) {
par0 = pr0;
par1 = pr1;
this.x = x;
seg0 = s0;
seg1 = s1;
#if DETAILED_DEBUG
System.Diagnostics.Debug.Assert(ApproximateComparer.Close(x, s0[pr0], ApproximateComparer.IntersectionEpsilon*10),
string.Format("intersection not at curve[param]; x = {0}, s0[pr0] = {1}, diff = {2}", x, s0[pr0], x - s0[pr0]));
System.Diagnostics.Debug.Assert(ApproximateComparer.Close(x, s1[pr1], ApproximateComparer.IntersectionEpsilon*10),
string.Format("intersection not at curve[param]; x = {0}, s1[pr1] = {1}, diff = {2}", x, s1[pr1], x - s1[pr1]));
#endif
}
示例14: Serialize
internal static void Serialize(string fileName, ICurve i) {
Stream file = File.Open(fileName, FileMode.Create);
// Create a formatter object based on command line arguments
IFormatter formatter = new BinaryFormatter();
// Serialize the object graph to stream
formatter.Serialize(file, i);
// All done
file.Close();
}
示例15: Interpolate
internal static List<LineSegment> Interpolate(double a, ref Point ap, double b, ref Point bp, ICurve s,
double eps) {
var r = new List<LineSegment>();
if (IsCloseToLineSeg(a, ref ap, b, ref bp, s, eps))
r.Add(new LineSegment(ap, bp));
else {
double m = 0.5*(a + b);
Point mp = s[m];
r.AddRange(Interpolate(a, ref ap, m, ref mp, s, eps));
r.AddRange(Interpolate(m, ref mp, b, ref bp, s, eps));
}
return r;
}