예제 #1
0
void WallsUnits::applyHeightCorrections(ULength& dist, UAngle& fsInc, UAngle& bsInc, ULength ih, ULength th) const
{
    if (inch.isNonzero() || ih.isNonzero() || th.isNonzero())
    {
        UAngle inc = avgInc(fsInc + incv, bsInc + incvb);
        if (inc.isValid() && !isVertical(inc))
        {
            // horizontal offset before height correction
            ULength ne = ucos(inc) * (dist + incd);
            // vertical offset before height correction
            ULength u = usin(inc) * (dist + incd);

            u += inch;
            if (ih.isValid()) u += ih;
            if (th.isValid()) u -= th;

            // adjust fsInc/bsInc so that their new avg
            // is the corrected inclination
            UAngle dinc = uatan2(u, ne) - inc;
            fsInc += dinc;
            bsInc += (typevb_corrected ? dinc : -dinc);

            dist = usqrt(usq(ne) + usq(u)) - incd;
        }
    }
}
예제 #2
0
UAngle WallsUnits::avgInc(UAngle fsInc, UAngle bsInc) const
{
    if (!typevb_corrected)
    {
        bsInc = -bsInc;
    }
    if (!fsInc.isValid())
    {
        return bsInc;
    }
    else if (!bsInc.isValid())
    {
        return fsInc;
    }

    return (fsInc + bsInc) * 0.5;
}