considering class:
public class point3d { public double x; public double y; public double z; public point3d(double x, double y, double z) { x = x; y = y; z = z; } public double distanceto(point3d to) { double dx = math.abs(to.x - x); double dy = math.abs(to.y - y); double dz = math.abs(to.z - z); return math.sqrt(dx * dx + dy * dy + dz * dz); } } and class:
public class segment { public point3d from; public point3d to; public double? radius; public segment(point3d from, point3d to, double? radius) { = from; = to; radius = radius; } public double length { { double straightlength = from.distanceto(to); if (radius == null) return straightlength; if (radius < straightlength/ 2d) throw new exception(); // compute arcuate segment length } } } i compute length of arc (with radius) passing through from , to 3d points.
some welcome!
according http://mathworld.wolfram.com/isoscelestriangle.html
straightlength / 2 = radius * sin( 1/2 * angle) therefore:
angle = 2 * arcsin( straightlength / 2 / radius) and
arclength = radius * angle;
Comments
Post a Comment