计算弧形段长度的公式

时间:2015-07-17 09:30:40

标签: c# computational-geometry

考虑到班级:

Cursor c=context.getContentResolver().query(HostProvider.Hosts.CONTENT_URI,null, Hosts.MAC_ADDR +"=" +String.valueOf(mhost.mac_addr),null,HostProvider.Hosts.NAME + " ASC");

上课:

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);
    }

}

我想计算通过public class Segment { public Point3D From; public Point3D To; public double? Radius; public Segment(Point3D from, Point3D to, double? radius) { From = from; To = to; Radius = radius; } public double Length { get { double straightLength = From.DistanceTo(To); if (Radius == null) return straightLength; if (Radius < straightLength/ 2d) throw new Exception(); // Compute the arcuate segment length } } } Radius 3D点的弧的长度(From}。

欢迎提供一些帮助!

2 个答案:

答案 0 :(得分:2)

根据http://mathworld.wolfram.com/IsoscelesTriangle.html

straightLength / 2 = Radius * sin( 1/2 * angle)

因此:

angle = 2 * arcsin( straightLength / 2 / Radius)

arcLength = Radius * angle;

答案 1 :(得分:0)

还有一个参考: from math.stackexchange

S =弧的长度= r * theta, 其中r =半径和Cos(θ)=(2个矢量的点积)/(这些矢量的模数的乘积)