// Build outer transformation matrix for the positioning
void CCPACSFuselagePositioning::BuildMatrix(void)
{
    // Compose the transformation for the tip section reference point.
    // The positioning transformation is basically a translation in two steps:
    // 1. from the fuselage origin to the startPoint (= endPoint of previous positioning)
    // 2. from the innerPoint to the endPoint with coordinates given
    //    in a "spherical" coordinate system (length, sweepAngle, dihedralAngle).
    // The original section is neither rotated by sweepAngle nor by dihedralAngle.

    // Calculate the cartesian translation components for step two from "spherical" input coordinates
    CTiglTransformation tempTransformation;
    tempTransformation.SetIdentity();
    tempTransformation.AddRotationZ(-sweepangle);
    tempTransformation.AddRotationX(dihedralangle);
    gp_Pnt tempPnt = tempTransformation.Transform(gp_Pnt(0.0, length, 0.0));

    // Setup transformation combining both steps
    endTransformation.SetIdentity();
    endTransformation.AddTranslation( startPoint.x + tempPnt.X() , 
                                        startPoint.y + tempPnt.Y() , 
                                        startPoint.z + tempPnt.Z() );

    // calculate outer section point by transforming origin
    tempPnt = endTransformation.Transform(gp_Pnt(0.0, 0.0, 0.0));
    endPoint.x = tempPnt.X();
    endPoint.y = tempPnt.Y();
    endPoint.z = tempPnt.Z();
}
Esempio n. 2
0
// Returns the positioning matrix for a given section index
CTiglTransformation CCPACSWingPositionings::GetPositioningTransformation(std::string sectionIndex)
{
    Update();
    CCPACSWingPositioningIterator iter = positionings.find(sectionIndex);
        
    // check, if section has positioning definition, if not
    // return Zero-Transformation
    if (iter == positionings.end()){
        CTiglTransformation zeroTrans;
        zeroTrans.SetIdentity();
        return zeroTrans;
    }
       
    return iter->second->GetOuterTransformation();
}