计算弧形段长度的公式
Formula to compute an arcuate segment length
考虑 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);
}
}
和class:
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
}
}
}
我想计算通过 From
和 To
3D 点的弧长(Radius
)。
欢迎提供帮助!
根据http://mathworld.wolfram.com/IsoscelesTriangle.html
straightLength / 2 = Radius * sin( 1/2 * angle)
因此:
angle = 2 * arcsin( straightLength / 2 / Radius)
和
arcLength = Radius * angle;
多一个参考:
from math.stackexchange
S=弧长=r*theta,
其中 r= 半径和 Cos(theta)=(2 个向量的点积)/(这些向量的模数的乘积)
考虑 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);
}
}
和class:
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
}
}
}
我想计算通过 From
和 To
3D 点的弧长(Radius
)。
欢迎提供帮助!
根据http://mathworld.wolfram.com/IsoscelesTriangle.html
straightLength / 2 = Radius * sin( 1/2 * angle)
因此:
angle = 2 * arcsin( straightLength / 2 / Radius)
和
arcLength = Radius * angle;
多一个参考: from math.stackexchange
S=弧长=r*theta, 其中 r= 半径和 Cos(theta)=(2 个向量的点积)/(这些向量的模数的乘积)