--- trunk/src/math/Triangle.cpp 2009/11/25 20:02:06 1390 +++ branches/development/src/math/Triangle.cpp 2010/07/09 23:08:25 1465 @@ -1,4 +1,4 @@ -/* Copyright (c) 2008 The University of Notre Dame. All Rights Reserved. +/* Copyright (c) 2008, 2010 The University of Notre Dame. All Rights Reserved. * * The University of Notre Dame grants you ("Licensee") a * non-exclusive, royalty free, license to use, modify and @@ -44,7 +44,7 @@ * * Created by Charles F. Vardeman II on 29 July 2008. * @author Charles F. Vardeman II - * @version $Id: Triangle.cpp,v 1.4 2009-11-25 20:02:01 gezelter Exp $ + * @version $Id$ * */ @@ -53,7 +53,7 @@ using namespace OpenMD; using namespace OpenMD; -Triangle::Triangle() : HaveNormal_(false), HaveCentroid_(false), +Triangle::Triangle() : HaveNormal_(false), HaveUnitNormal_(false), HaveCentroid_(false), HaveArea_(false), area_(0.0), normal_(V3Zero), centroid_(V3Zero), facetVelocity_(V3Zero), mass_(0.0), a_(V3Zero), b_(V3Zero), c_(V3Zero){ @@ -76,12 +76,19 @@ RealType Triangle::computeArea(){ area_ = getNormal().length() * 0.5; return area_; } - +// This should return the normal for our calculations. Vector3d Triangle::computeNormal(){ HaveNormal_ = true; normal_ = cross(a_,b_); return normal_; } +// This should return the normal for our calculations. +Vector3d Triangle::computeUnitNormal(){ + HaveUnitNormal_ = true; + unitnormal_ = cross(a_,b_); + unitnormal_.normalize(); + return unitnormal_; +} Vector3d Triangle::computeCentroid(){ HaveCentroid_ = true;