Exemplo n.º 1
0
 public static Rational Sqrt(Rational r)
 {
     r = r.Reduce();
     return(new Rational(Sqrt(r.Numerator), Sqrt(r.Denomerator)));
 }
Exemplo n.º 2
0
 public static bool IsSquare(Rational r)
 {
     r = r.Reduce();
     return(IsSquare(r.Numerator) && IsSquare(r.Denomerator));
 }
Exemplo n.º 3
0
 public SolutionSpec MakeFinalFolds(SolutionSpec sol, Rational k, params int[] pointIndices)
 {
     return(MakeFinalFolds(sol, k, pointIndices.Select(i => sol.DestPoints[i])));
 }
Exemplo n.º 4
0
 private static bool IsBetween(Rational a, Rational x, Rational b)
 {
     return((a - x) * (b - x) <= 0);
 }
Exemplo n.º 5
0
 public Vector Move(Rational shiftX, Rational shiftY)
 {
     return(new Vector(X + shiftX, Y + shiftY));
 }
Exemplo n.º 6
0
 public SolutionSpec MakeFinalFolds(SolutionSpec sol, Rational k)
 {
     return(MakeFinalFolds(sol, k, sol.DestPoints));
 }
Exemplo n.º 7
0
 public Vector(Rational x, Rational y)
 {
     X = x;
     Y = y;
 }
Exemplo n.º 8
0
 public Segment Move(Rational shiftX, Rational shiftY)
 {
     return(new Segment(Start.Move(shiftX, shiftY), End.Move(shiftX, shiftY)));
 }
Exemplo n.º 9
0
 private static Vector ReflectY(Vector v, Rational height)
 {
     return(new Vector(v.X, height - v.Y + height));
 }
Exemplo n.º 10
0
 private static Vector ShiftY(Vector v, Rational shift)
 {
     return(new Vector(v.X, v.Y + shift));
 }
Exemplo n.º 11
0
 public static List <List <GNode <PEdge, PNode> > > GetReflectedAndShiftedCycles(List <List <GNode <PEdge, PNode> > > cycles,
                                                                                 Rational reflectionH, Rational shiftH)
 {
     return(CloneCyclesWithUpdateProjection(cycles, v => ShiftY(ReflectY(v, reflectionH), shiftH)));
 }