Esempio n. 1
0
// Construct from dictionary
Foam::plane::plane(const dictionary& dict)
:
    unitVector_(vector::zero),
    basePoint_(point::zero)
{
    word planeType(dict.lookup("planeType"));

    if (planeType == "planeEquation")
    {
        const dictionary& subDict = dict.subDict("planeEquationDict");
        scalarList C(4);

        C[0] = readScalar(subDict.lookup("a"));
        C[1] = readScalar(subDict.lookup("b"));
        C[2] = readScalar(subDict.lookup("c"));
        C[3] = readScalar(subDict.lookup("d"));

        calcPntAndVec(C);

    }
    else if (planeType == "embeddedPoints")
    {
        const dictionary& subDict = dict.subDict("embeddedPoints");

        point point1(subDict.lookup("point1"));
        point point2(subDict.lookup("point2"));
        point point3(subDict.lookup("point3"));

        calcPntAndVec(point1, point2, point3);
    }
    else if (planeType == "pointAndNormal")
    {
        const dictionary& subDict = dict.subDict("pointAndNormalDict");

        basePoint_ = subDict.lookup("basePoint");
        unitVector_ = subDict.lookup("normalVector");
        unitVector_ /= mag(unitVector_);
    }
    else
    {
        FatalIOErrorIn
        (
            "plane::plane(const dictionary&)",
            dict
        )
        << "Invalid plane type: " << planeType
        << abort(FatalIOError);
    }
}
Esempio n. 2
0
// Construct from three points
Foam::plane::plane
(
    const point& a,
    const point& b,
    const point& c
)
{
    calcPntAndVec(a, b, c);
}
Esempio n. 3
0
// Construct from plane equation
Foam::plane::plane(const scalarList& C)
{
    calcPntAndVec(C);
}