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