我需要沿着一个位于倾斜平面上的椭圆获得点的坐标。椭圆也在XY平面中旋转。我能够沿着旋转的水平椭圆获得正确的X和Y坐标,以及倾斜椭圆的水平投影的X和Y点,但是无法计算出我需要获得Z值的数学/三角形浸渍椭圆上的点。我试图通过使用从椭圆中心到沿着倾斜椭圆的每个点的矢量的明显倾角来做到这一点。
以下是我使用的代码:
class ellipsoid
{
public ellipsoid() { }
public double bearing { get; set; }
public double plunge { get; set; }
public double dip { get; set; }
public double x { get; set; }
public double y { get; set; }
public double z { get; set; }
}
class exampleCalc
{
public void createDippingEllipse(ellipsoid ellipsoid, double majorAxis, double semiMajorAxis)
// majorAxis is the longest axis, semiMajorAxis is the shorter axis
{
double semiMajorAxisApparent = 0;
Int32 strNum = 1;
point delta = new point();
point horz = new point();
point ep = new point();
point p = new point();
p.x = ellipsoid.x;
p.y = ellipsoid.y;
p.z = ellipsoid.z;
// az represents the angular interval along which points will be located
for (Int32 az = 0; az <= 360; az = az + 10)
{
double rakeAngle = 0;
if (az >= 0 && az <= 90)
{
rakeAngle = az;
}
if (az > 90 && az <= 180)
{
rakeAngle = 180 - az;
}
if (az > 180 && az <= 270)
{
rakeAngle = az - 180;
}
if (az > 270 && az <= 360)
{
rakeAngle = 360 - az;
}
if (ellipsoid.dip == 90)
{
semiMajorAxisApparent = semiMajorAxis;
}
else
{
semiMajorAxisApparent = semiMajorAxis * Math.Cos(ep.degreesToRadians(Math.Abs(ellipsoid.dip)));
}
double cosAz = Math.Cos(ep.degreesToRadians(az));
double sinAz = Math.Sin(ep.degreesToRadians(az));
// convert mathematical bearing to bearing where north is zero
double bearing0north = ellipsoid.bearing + 90;
if (bearing0north > 360) { bearing0north = 360 - bearing0north; }
double cosBearing = Math.Cos(ep.degreesToRadians(bearing0north));
double sinBearing = Math.Sin(ep.degreesToRadians(bearing0north));
// delta.x and delta.y are correct
delta.x = (majorAxis * cosBearing * cosAz) - (semiMajorAxisApparent * sinBearing * sinAz);
delta.y = (majorAxis * cosAz * sinBearing) + (semiMajorAxisApparent * sinAz * cosBearing);
double horzDist = Math.Sqrt(Math.Pow(delta.x, 2) + Math.Pow(delta.y, 2));
// uncorrected for apparent horz length
horz.x = (majorAxis * cosBearing * cosAz) - (semiMajorAxis * sinBearing * sinAz);
horz.y = (majorAxis * cosAz * sinBearing) + (semiMajorAxis * sinAz * cosBearing);
double apparentDip = Math.Atan(Math.Tan(ep.degreesToRadians(Math.Abs(ellipsoid.bearing))) * Math.Sin(ep.degreesToRadians(rakeAngle)));
// delta.z is not correct
delta.z = horzDist * Math.Atan(apparentDip);
ep.x = p.x + delta.x;
ep.y = p.y + delta.y;
ep.z = p.z + delta.z;
}
}
}
答案 0 :(得分:0)
你真正尝试解决一个相对简单的问题的最复杂的解决方案(除非选择非惯性框架)。
简单地求解位于X-Y平面内的椭圆中的所有数学,关于原点,并计算将椭圆平移并旋转到所需位置和方向的仿射矩阵。然后简单地将矩阵应用于每个计算点以获得正确的定向点。