Simple dx render example.
This commit is contained in:
parent
36515556b8
commit
e0cad34d55
22 changed files with 339 additions and 60 deletions
|
@ -75,7 +75,34 @@ void TriFace::associateWidthEdges()
|
|||
mEdge2->associateFace(mId);
|
||||
}
|
||||
|
||||
std::vector<Point> TriFace::getNodeLocations() const
|
||||
std::vector<Point> TriFace::getNodeLocations(Orientation orientation) const
|
||||
{
|
||||
return {mEdge0->getNode0()->getPoint(), mEdge0->getNode1()->getPoint(), mEdge1->getNode1()->getPoint()};
|
||||
if (orientation != getOrientation())
|
||||
{
|
||||
return { mEdge0->getNode0()->getPoint(), mEdge0->getNode1()->getPoint(), mEdge1->getNode1()->getPoint() };
|
||||
}
|
||||
else
|
||||
{
|
||||
return { mEdge0->getNode0()->getPoint(), mEdge1->getNode1()->getPoint(), mEdge0->getNode1()->getPoint() };
|
||||
}
|
||||
}
|
||||
|
||||
Vector TriFace::getNormal() const
|
||||
{
|
||||
auto v0 = mEdge0->getNode0()->getPoint().getDelta(mEdge0->getNode1()->getPoint());
|
||||
auto v1 = mEdge0->getNode0()->getPoint().getDelta(mEdge1->getNode1()->getPoint());
|
||||
return v0.crossProduct(v1).getNormalized();
|
||||
}
|
||||
|
||||
AbstractFace::Orientation TriFace::getOrientation() const
|
||||
{
|
||||
Vector z_norm(0, 0, 1);
|
||||
if (z_norm.dotProduct(getNormal()) < 0.0)
|
||||
{
|
||||
return Orientation::CW;
|
||||
}
|
||||
else
|
||||
{
|
||||
return Orientation::CCW;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue