Skip to content

Commit

Permalink
Merge pull request #204 from mme1950/20231117_mme_matrix4
Browse files Browse the repository at this point in the history
Replace double[] with Matrix4
  • Loading branch information
DomCR authored Nov 20, 2023
2 parents 0a716f0 + fb1a5ce commit 69f4555
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 21 deletions.
43 changes: 25 additions & 18 deletions ACadSharp/IO/DWG/DwgStreamReaders/DwgObjectReader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3047,24 +3047,31 @@ private MultiLeaderAnnotContext readMultiLeaderAnnotContext(CadMLeaderTemplate t
// - OCS to WCS (using normal vector),
// - Scaling (using scale vector)
// - Translation (using location)
// Simply read an array of 16 doubles:
double[] matrix = annotContext.TransformationMatrix;
matrix[0] = _objectReader.ReadBitDouble();
matrix[1] = _objectReader.ReadBitDouble();
matrix[2] = _objectReader.ReadBitDouble();
matrix[3] = _objectReader.ReadBitDouble();
matrix[4] = _objectReader.ReadBitDouble();
matrix[5] = _objectReader.ReadBitDouble();
matrix[6] = _objectReader.ReadBitDouble();
matrix[7] = _objectReader.ReadBitDouble();
matrix[8] = _objectReader.ReadBitDouble();
matrix[9] = _objectReader.ReadBitDouble();
matrix[10] = _objectReader.ReadBitDouble();
matrix[11] = _objectReader.ReadBitDouble();
matrix[12] = _objectReader.ReadBitDouble();
matrix[13] = _objectReader.ReadBitDouble();
matrix[14] = _objectReader.ReadBitDouble();
matrix[15] = _objectReader.ReadBitDouble();
double m00 = _objectReader.ReadBitDouble();
double m10 = _objectReader.ReadBitDouble();
double m20 = _objectReader.ReadBitDouble();
double m30 = _objectReader.ReadBitDouble();

double m01 = _objectReader.ReadBitDouble();
double m11 = _objectReader.ReadBitDouble();
double m21 = _objectReader.ReadBitDouble();
double m31 = _objectReader.ReadBitDouble();

double m02 = _objectReader.ReadBitDouble();
double m12 = _objectReader.ReadBitDouble();
double m22 = _objectReader.ReadBitDouble();
double m32 = _objectReader.ReadBitDouble();

double m03 = _objectReader.ReadBitDouble();
double m13 = _objectReader.ReadBitDouble();
double m23 = _objectReader.ReadBitDouble();
double m33 = _objectReader.ReadBitDouble();

annotContext.TransformationMatrix = new Matrix4(
m00, m10, m20, m30,
m01, m11, m21, m31,
m02, m12, m22, m32,
m03, m13, m23, m33);
}
//END IF Has contents block
//END IF Has text contents
Expand Down
4 changes: 1 addition & 3 deletions ACadSharp/Objects/MultiLeaderAnnotContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -280,8 +280,6 @@ public partial class MultiLeaderAnnotContext : CadObject
[DxfCodeValue(93)]
public Color BlockContentColor { get; set; }

// TODO ? should double[] be replaced by a TransformationMatrix type? -> CSMath.Matrix4

/// <summary>
/// Gets a array of 16 doubles containg the complete transformation
/// matrix.
Expand All @@ -298,7 +296,7 @@ public partial class MultiLeaderAnnotContext : CadObject
/// </list>
/// </remarks>
[DxfCodeValue(93)]
public double[] TransformationMatrix { get; } = new double[16];
public Matrix4 TransformationMatrix { get; set; }

/// <summary>
/// Base point
Expand Down

0 comments on commit 69f4555

Please sign in to comment.