From: Josh <axl...@gm...> - 2009-10-12 10:32:14
|
Charles can you take a look at this? The interpolation results look wrong on screen. Walking around is very jerky. axl...@us... wrote: > Revision: 562 > http://hgengine.svn.sourceforge.net/hgengine/?rev=562&view=rev > Author: axlecrusher > Date: 2009-10-11 15:40:51 +0000 (Sun, 11 Oct 2009) > > Log Message: > ----------- > update > > Modified Paths: > -------------- > Mercury2/src/DataTypes/MTriangle.cpp > Mercury2/src/DataTypes/MTriangle.h > > Modified: Mercury2/src/DataTypes/MTriangle.cpp > =================================================================== > --- Mercury2/src/DataTypes/MTriangle.cpp 2009-10-11 03:34:07 UTC (rev 561) > +++ Mercury2/src/DataTypes/MTriangle.cpp 2009-10-11 15:40:51 UTC (rev 562) > @@ -35,6 +35,23 @@ > return MercuryVertex(ru, rv, 1-(ru+rv)); > } > > +MercuryVertex MTriangle::InterpolatePosition(const MercuryVertex& barycentric) > +{ > + MercuryVertex result( m_verts[0] ); > + > + barycentric.Print(); > + > + result += (m_verts[1] - m_verts[0])*barycentric; > + result += (m_verts[2] - m_verts[0])*barycentric; > + > +// result.Print(); > + > + result[3] = 0; > + > + result.Print(); > + return result; > +} > + > bool MTriangle::IsInTriangle(const MercuryVertex& p) > { > MercuryVertex v = Barycentric(p); > > Modified: Mercury2/src/DataTypes/MTriangle.h > =================================================================== > --- Mercury2/src/DataTypes/MTriangle.h 2009-10-11 03:34:07 UTC (rev 561) > +++ Mercury2/src/DataTypes/MTriangle.h 2009-10-11 15:40:51 UTC (rev 562) > @@ -13,9 +13,10 @@ > bool IsInTriangle( const MercuryVertex& p ); > > float Area(); > - > + MercuryVertex InterpolatePosition(const MercuryVertex& barycentric); > + > bool operator == (const MTriangle& rhs); > - private: > +// private: > > MercuryVertex m_verts[3]; > }; > > > This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. > > ------------------------------------------------------------------------------ > Come build with us! The BlackBerry(R) Developer Conference in SF, CA > is the only developer event you need to attend this year. Jumpstart your > developing skills, take BlackBerry mobile applications to market and stay > ahead of the curve. Join us from November 9 - 12, 2009. Register now! > http://p.sf.net/sfu/devconference > _______________________________________________ > Hgengine-cvs mailing list > Hge...@li... > https://lists.sourceforge.net/lists/listinfo/hgengine-cvs > |
From: Josh A. <axl...@gm...> - 2009-10-12 15:37:12
|
I think I figured it out while at work. I forgot that it should be the barycentric * length of the edge.I'll try to fix it when I get home. I guess I was changing the direction of the edge vector. Josh On Mon, Oct 12, 2009 at 6:31 AM, Josh <axl...@gm...> wrote: > Charles can you take a look at this? > The interpolation results look wrong on screen. Walking around is very > jerky. > > > > > axl...@us... wrote: > >> Revision: 562 >> http://hgengine.svn.sourceforge.net/hgengine/?rev=562&view=rev >> Author: axlecrusher >> Date: 2009-10-11 15:40:51 +0000 (Sun, 11 Oct 2009) >> >> Log Message: >> ----------- >> update >> >> Modified Paths: >> -------------- >> Mercury2/src/DataTypes/MTriangle.cpp >> Mercury2/src/DataTypes/MTriangle.h >> >> Modified: Mercury2/src/DataTypes/MTriangle.cpp >> =================================================================== >> --- Mercury2/src/DataTypes/MTriangle.cpp 2009-10-11 03:34:07 UTC >> (rev 561) >> +++ Mercury2/src/DataTypes/MTriangle.cpp 2009-10-11 15:40:51 UTC >> (rev 562) >> @@ -35,6 +35,23 @@ >> return MercuryVertex(ru, rv, 1-(ru+rv)); >> } >> +MercuryVertex MTriangle::InterpolatePosition(const MercuryVertex& >> barycentric) >> +{ >> + MercuryVertex result( m_verts[0] ); >> + >> + barycentric.Print(); >> + >> + result += (m_verts[1] - m_verts[0])*barycentric; >> + result += (m_verts[2] - m_verts[0])*barycentric; >> + >> +// result.Print(); >> + >> + result[3] = 0; >> + >> + result.Print(); >> + return result; >> +} >> + >> bool MTriangle::IsInTriangle(const MercuryVertex& p) >> { >> MercuryVertex v = Barycentric(p); >> >> Modified: Mercury2/src/DataTypes/MTriangle.h >> =================================================================== >> --- Mercury2/src/DataTypes/MTriangle.h 2009-10-11 03:34:07 UTC (rev 561) >> +++ Mercury2/src/DataTypes/MTriangle.h 2009-10-11 15:40:51 UTC (rev 562) >> @@ -13,9 +13,10 @@ >> bool IsInTriangle( const MercuryVertex& p ); >> >> float Area(); >> - >> + MercuryVertex InterpolatePosition(const MercuryVertex& >> barycentric); >> + >> bool operator == (const MTriangle& rhs); >> - private: >> +// private: >> >> MercuryVertex m_verts[3]; >> }; >> >> >> This was sent by the SourceForge.net collaborative development platform, >> the world's largest Open Source development site. >> >> >> ------------------------------------------------------------------------------ >> Come build with us! The BlackBerry(R) Developer Conference in SF, CA >> is the only developer event you need to attend this year. Jumpstart your >> developing skills, take BlackBerry mobile applications to market and stay >> ahead of the curve. Join us from November 9 - 12, 2009. Register now! >> http://p.sf.net/sfu/devconference >> _______________________________________________ >> Hgengine-cvs mailing list >> Hge...@li... >> https://lists.sourceforge.net/lists/listinfo/hgengine-cvs >> >> > > -- http://www.stepmaniaonline.com |