예제 #1
0
 public static Rational Sqrt(Rational r)
 {
     r = r.Reduce();
     return(new Rational(Sqrt(r.Numerator), Sqrt(r.Denomerator)));
 }
예제 #2
0
 public static bool IsSquare(Rational r)
 {
     r = r.Reduce();
     return(IsSquare(r.Numerator) && IsSquare(r.Denomerator));
 }
예제 #3
0
 public SolutionSpec MakeFinalFolds(SolutionSpec sol, Rational k, params int[] pointIndices)
 {
     return(MakeFinalFolds(sol, k, pointIndices.Select(i => sol.DestPoints[i])));
 }
예제 #4
0
 private static bool IsBetween(Rational a, Rational x, Rational b)
 {
     return((a - x) * (b - x) <= 0);
 }
예제 #5
0
 public Vector Move(Rational shiftX, Rational shiftY)
 {
     return(new Vector(X + shiftX, Y + shiftY));
 }
예제 #6
0
 public SolutionSpec MakeFinalFolds(SolutionSpec sol, Rational k)
 {
     return(MakeFinalFolds(sol, k, sol.DestPoints));
 }
예제 #7
0
 public Vector(Rational x, Rational y)
 {
     X = x;
     Y = y;
 }
예제 #8
0
 public Segment Move(Rational shiftX, Rational shiftY)
 {
     return(new Segment(Start.Move(shiftX, shiftY), End.Move(shiftX, shiftY)));
 }
예제 #9
0
 private static Vector ReflectY(Vector v, Rational height)
 {
     return(new Vector(v.X, height - v.Y + height));
 }
예제 #10
0
 private static Vector ShiftY(Vector v, Rational shift)
 {
     return(new Vector(v.X, v.Y + shift));
 }
예제 #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)));
 }