public Vector2 ComputeRightTangent(Vector2[] d, int end) /* d; Digitized points */ /* end; Index to "right" end of region */ { Vector2 tHat2; tHat2 = V2SubII(d[end - 1], d[end]); // tHat2 = V2Normalize(tHat2); tHat2.V2Normalize(); // System.out.println("IN RIGHT TANGENT:"+tHat2.xval()+" "+tHat2.yval() ); return tHat2; }
/* * ComputeLeftTangent, ComputeRightTangent, ComputeCenterTangent : *Approximate unit tangents at endpoints and "center" of digitized curve */ public Vector2 ComputeLeftTangent(Vector2[] d, int end) /* d; Digitized points*/ /* end; Index to "left" end of region */ { Vector2 tHat1; tHat1 = V2SubII(d[end + 1], d[end]); // tHat1 = V2Normalize(tHat1); // System.out.println("end "+end+" d[end+1] "+d[end+1].xval()+" "+d[end+1].yval()+" d[end] // "+d[end].xval()+" "+d[end].yval()+" IN LEFT TANGENT:"+tHat1.xval()+" "+tHat1.yval() ); tHat1.V2Normalize(); // System.out.println("IN LEFT TANGENT:"+tHat1.xval()+" "+tHat1.yval() ); return tHat1; }
public Vector2 ComputeCenterTangent(Vector2[] d, int center) /* d; Digitized points */ /*center; Index to point inside region */ { Vector2 V1, V2, tHatCenter; V1 = V2SubII(d[center - 1], d[center]); V2 = V2SubII(d[center], d[center + 1]); tHatCenter = new Vector2(); tHatCenter.xset((V1.xval() + V2.xval()) / 2.0); tHatCenter.yset((V1.yval() + V2.yval()) / 2.0); tHatCenter.V2Normalize(); return tHatCenter; }