/// <summary> /// The basin angle is decided against the horizontal line [1,0] /// </summary> private static FP BasinAngle(AdvancingFrontNode node) { FP ax = node.Point.X - node.Next.Next.Point.X; FP ay = node.Point.Y - node.Next.Next.Point.Y; return(FP.Atan2(ay, ax)); }
private bool AngleSign() { Point a = (_head.Next - _head); Point b = (_tail - _head); return(FP.Atan2(a.Cross(b), a.Dot(b)) >= 0); }
private FP Angle(Point p) { Point a = (p.Next - p); Point b = (p.Prev - p); return(FP.Atan2(a.Cross(b), a.Dot(b))); }
private static FP Angle(TriangulationPoint origin, TriangulationPoint pa, TriangulationPoint pb) { /* Complex plane * ab = cosA +i*sinA * ab = (ax + ay*i)(bx + by*i) = (ax*bx + ay*by) + i(ax*by-ay*bx) * atan2(y,x) computes the principal value of the argument function * applied to the complex number x+iy * Where x = ax*bx + ay*by * y = ax*by - ay*bx */ FP px = origin.X; FP py = origin.Y; FP ax = pa.X - px; FP ay = pa.Y - py; FP bx = pb.X - px; FP by = pb.Y - py; FP x = ax * by - ay * bx; FP y = ax * bx + ay * by; FP angle = FP.Atan2(x, y); return(angle); }
/// <summary> /// ??? /// </summary> /// <param name="node">middle node</param> /// <returns>the angle between 3 front nodes</returns> private static FP HoleAngle(AdvancingFrontNode node) { // XXX: do we really need a signed angle for holeAngle? // could possible save some cycles here /* Complex plane * ab = cosA +i*sinA * ab = (ax + ay*i)(bx + by*i) = (ax*bx + ay*by) + i(ax*by-ay*bx) * atan2(y,x) computes the principal value of the argument function * applied to the complex number x+iy * Where x = ax*bx + ay*by * y = ax*by - ay*bx */ FP px = node.Point.X; FP py = node.Point.Y; FP ax = node.Next.Point.X - px; FP ay = node.Next.Point.Y - py; FP bx = node.Prev.Point.X - px; FP by = node.Prev.Point.Y - py; return(FP.Atan2(ax * by - ay * bx, ax * bx + ay * by)); }