Jump to content
  • Advertisement
Sign in to follow this  

Resize Quirk

This topic is 3302 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I get a vector iterator outside of range on the following line of code. iPEQuantity's size is 4.

These are the definitions.
std::vector<Vector2<Real> >m_kSPositions;

namespace Wm4

template <class Real>
class Vector2
    // construction
    Vector2 ();  // uninitialized
    Vector2 (Real fX, Real fY);
    Vector2 (const Real* afTuple);
    Vector2 (const Vector2& rkV);
//Other functions..

Should mCount be 1238684?
	void _Insert_n(const_iterator _Where,
		size_type _Count, const _Ty& _Val)
		{	// insert _Count * _Val at _Where

Share this post

Link to post
Share on other sites
The value of simplePolygon is [0]() which is odd. If I try to retrieve the values it works though.

Wm4::TriangulateEC<Real>::Positions simplePolygon;

Wm4::Vector2<Real> vec2(1,0);
Wm4::Vector2<Real> vec3(0,-1);
Wm4::Vector2<Real> vec4(1,-1);
Wm4::Vector2<Real> vec5(3,1);

Wm4::TriangulateEC<Real>::Indices tIndices;


TriangulateEC<Real>::TriangulateEC (const Positions& rkPositions,
Query::Type eQueryType, Real fEpsilon, Indices& rkTriangles)
// No extra elements are needed for triangulating a simple polygon.

// Triangulate the unindexed polygon.
int iVQuantity = (int)rkPositions.size();
const int* aiIndex = 0;

template <class Real>
void TriangulateEC<Real>::InitializePositions (const Positions& rkPositions,
Query::Type eQueryType, Real fEpsilon, int iExtraElements)
int iPQuantity = (int)rkPositions.size();
assert(iPQuantity >= 3);
int iPEQuantity = iPQuantity + iExtraElements;

if (eQueryType == Query::QT_FILTERED)
assert((Real)0.0 <= fEpsilon && fEpsilon <= (Real)1.0);

Vector2<Real> kMin, kMax, kRange;
Real fScale, fRMax;
int i;


Share this post

Link to post
Share on other sites
What are you talking about? That doesn't look like remotely related code. (Your variable names don't really help.)

Show the code where you use the vector of Vector2 objects.

I thought it was clear that I was talking about std::vector<Vector2<Real> >m_kSPositions;. I'm sure you do something with it other than just attempt to .resize() it - it'd be pretty useless that way.

Also, this:

Wm4::TriangulateEC<Real> triangulate(simplePolygon,Wm4::Query::QT_RATIONAL,0,tIndices);

is not a function call. It's either a function declaration, or a constructor call (but why would you have a variable named "triangulate"?).

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!