Example #1
0
double Edge3D::angle(const Point3D &p1, const Point3D &p2) const
{
	Vector3D ab = this->vector();
	Vector3D ac;

    if (this->getP1()->match(p1))
    {
        ac = Vector3D(p1, p2);
    }
    else if (this->getP1()->match(p2))
    {
        ac = Vector3D(p2, p1);
    }
    else if (this->getP2()->match(p1))
    {
    	ac = Vector3D(p1, p2);
    	ab.multiply(-1.0);
    }
    else if (this->getP2()->match(p2))
    {
        ac = Vector3D(p2, p1);
    	ab.multiply(-1.0);
    }
    else
    {
        return -1.0;
    }

    return ab.angle(ac);
}