Opened 14 years ago
Last modified 6 years ago
#1283 closed defect
Assigning matrices is terribly inefficient (unneeded expand) — at Initial Version
Reported by: | asodja | Owned by: | asodja |
---|---|---|---|
Priority: | blocker | Milestone: | 1.14.0 |
Component: | New Instantiation | Version: | trunk |
Keywords: | Cc: | asodja |
Description
The following model calles function {{EulerAngles}} with same arguments for every element of the matrix:
{{{model TransformMatrix
function EulerAngles
"Computes transformation matrix for given Euler angles"
input Real phi;
input Real theta;
input Real psi;
output Real A[4, 4];
algorithm
A := diagonal(vector(ones(1, 4)));
A[1, 1] := cos(psi)*cos(phi) - cos(theta)*sin(phi)*sin(psi);
A[1, 2] := cos(psi)*sin(phi) + cos(theta)*cos(phi)*sin(psi);
A[1, 3] := sin(psi)*sin(theta);
A[2, 1] := -sin(psi)*cos(phi) - cos(theta)*sin(phi)*cos(psi);
A[2, 2] := -sin(psi)*sin(phi) + cos(theta)*cos(phi)*cos(psi);
A[2, 3] := cos(psi)*sin(theta);
A[3, 1] := sin(theta)*sin(phi);
A[3, 2] := -sin(theta)*cos(phi);
A[3, 3] := cos(theta);
end EulerAngles;
parameter Real phi = 0;
parameter Real theta = 0;
parameter Real psi = 0;
parameter Real T[4, 4]=EulerAngles(phi,theta,psi);
end TransformMatrix;}}}