Skip to content

Commit

Permalink
Angle & Distance added
Browse files Browse the repository at this point in the history
  • Loading branch information
halmaia committed Mar 10, 2023
1 parent e2a85ce commit cec5afa
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions SL3Reader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -281,15 +281,16 @@ public unsafe void Export3D(string path, bool includeUnreliable = false, bool ma
IFrame frame = frames[frame3DIndex];
GeoPoint augmentedCoordinate = augmentedCoordinates[frame3DIndex];

long offset = frame.DataOffset;
SeekExactly(offset);

SeekExactly(frame.DataOffset);
ReadExactly(sHeader);

ReadExactly(new(measurements, header.NumberOfUsedBytes));

double centralX = augmentedCoordinate.X, centralY = augmentedCoordinate.Y, centralZ = .3048 * augmentedCoordinate.Altitude;
(double sin, double cos) = double.SinCos((magneticHeading ? frame.MagneticHeading : frame.GNSSHeading) - .5 * double.Pi);
double centralX = augmentedCoordinate.X,
centralY = augmentedCoordinate.Y,
centralZ = .3048 * augmentedCoordinate.Altitude;

(double sin, double cos) =
double.SinCos((magneticHeading ? frame.MagneticHeading : frame.GNSSHeading) - .5 * double.Pi);

stringArray[0] = frame.CampaignID.ToString();
stringArray[1] = frame.Timestamp.ToString("yyyy'-'MM'-'dd HH':'mm':'ss.fff'Z'", invariantCulture);
Expand All @@ -302,8 +303,8 @@ public unsafe void Export3D(string path, bool includeUnreliable = false, bool ma

double delta = measurement->Delta;
double depth = measurement->Depth;
double distance = .3048* double.Hypot(delta, depth);
double angle = 90-(360 / double.Tau) * double.Atan2(depth, delta);
double distance = .3048 * double.Hypot(delta, depth);
double angle = 90 - (360 / double.Tau) * double.Atan2(depth, delta);

delta *= -.3048; // Negative/Left side

Expand All @@ -323,8 +324,8 @@ public unsafe void Export3D(string path, bool includeUnreliable = false, bool ma

double delta = measurement->Delta;
double depth = measurement->Depth;
double distance = .3048* double.Hypot(delta, depth);
double angle =90- (360 / double.Tau) * double.Atan2(depth, delta);
double distance = .3048 * double.Hypot(delta, depth);
double angle = 90 - (360 / double.Tau) * double.Atan2(depth, delta);

delta *= .3048; // Positive side

Expand Down

0 comments on commit cec5afa

Please sign in to comment.