vector<vector<Point3D> >

H

hannibal200480

Hi everyone,

Here about what it is.

vector<vector<Point3D> > pVector0;

pVector0 is a vector of vector of 3D points.

pVector0 is a vector of 3D points.

pVector0[j] is a 3D point.

I wanted to add a point pt3D to the m vector in pVector0, I have
write these two instructions which belong to a C++ program.

vector< vector<Vector3D> > pVector0;
pVector0[m].push_back(pt3D);

I have as error message: Segmentation fault (core dumped)

Could anyone give me suggestions?

Thanks!

hannibal
 
V

Victor Bazarov

Here about what it is.

vector<vector<Point3D> > pVector0;

pVector0 is a vector of vector of 3D points.

pVector0 is a vector of 3D points.

pVector0[j] is a 3D point.

I wanted to add a point pt3D to the m vector in pVector0, I have
write these two instructions which belong to a C++ program.

vector< vector<Vector3D> > pVector0;
pVector0[m].push_back(pt3D);

I have as error message: Segmentation fault (core dumped)

Could anyone give me suggestions?


What's the size of 'pVector0'? You're trying to access the m-th
element of it, do you know if it even exists?

V
 
H

hannibal200480

Victor said:
Here about what it is.

vector<vector<Point3D> > pVector0;

pVector0 is a vector of vector of 3D points.

pVector0 is a vector of 3D points.

pVector0[j] is a 3D point.

I wanted to add a point pt3D to the m vector in pVector0, I have
write these two instructions which belong to a C++ program.

vector< vector<Vector3D> > pVector0;
pVector0[m].push_back(pt3D);

I have as error message: Segmentation fault (core dumped)

Could anyone give me suggestions?



What's the size of 'pVector0'? You're trying to access the m-th
element of it, do you know if it even exists?

V

The size of pVector0 is not known.
I wanted to add m empty vectors to the vector and to add the point pt3D
to m vector.

vector< vector<Vector3D> > pVector0;
pVector0.insert(pVector0.end(),m);
pVector0[m].push_back(pt3D);
 
V

Victor Bazarov

Victor said:
Here about what it is.

vector<vector<Point3D> > pVector0;

pVector0 is a vector of vector of 3D points.

pVector0 is a vector of 3D points.

pVector0[j] is a 3D point.

I wanted to add a point pt3D to the m vector in pVector0, I have
write these two instructions which belong to a C++ program.

vector< vector<Vector3D> > pVector0;
pVector0[m].push_back(pt3D);

I have as error message: Segmentation fault (core dumped)

Could anyone give me suggestions?




What's the size of 'pVector0'? You're trying to access the m-th
element of it, do you know if it even exists?

V


The size of pVector0 is not known.


REALLY? Have you tried calling pVector0.size()?
I wanted to add m empty vectors to the vector and to add the point pt3D
to m vector.

If you add m vectors to the vector, what's their indices?
vector< vector<Vector3D> > pVector0;
pVector0.insert(pVector0.end(),m);
pVector0[m].push_back(pt3D);

V
 
J

Jonathan Mcdougall

Hi everyone,

Here about what it is.

vector<vector<Point3D> > pVector0;

pVector0 is a vector of vector of 3D points.

pVector0 is a vector of 3D points.

pVector0[j] is a 3D point.

I wanted to add a point pt3D to the m vector in pVector0,


Are you sure this 'm' vector exists?
I have
write these two instructions which belong to a C++ program.

vector< vector<Vector3D> > pVector0;
pVector0[m].push_back(pt3D);

If that's the only 2 lines you wrote, there's a problem. The vector is
empty and you are trying to access it's mth element. Illegal.

If you want to add a point, you first need to add a vector of points.

std::vector<Vector3D> vector_of_points;
vector_of_points.push_back(a_point);

pVector0.push_back(vector_of_points);

Remember: pVector0 is a vector of vectors of points.


Jonathan
 
H

hannibal200480

Victor said:
Victor said:
(e-mail address removed) wrote:

Here about what it is.

vector<vector<Point3D> > pVector0;

pVector0 is a vector of vector of 3D points.

pVector0 is a vector of 3D points.

pVector0[j] is a 3D point.

I wanted to add a point pt3D to the m vector in pVector0, I have
write these two instructions which belong to a C++ program.

vector< vector<Vector3D> > pVector0;
pVector0[m].push_back(pt3D);

I have as error message: Segmentation fault (core dumped)

Could anyone give me suggestions?




What's the size of 'pVector0'? You're trying to access the m-th
element of it, do you know if it even exists?

V



The size of pVector0 is not known.



REALLY? Have you tried calling pVector0.size()?


I have tried calling pVector0.size(),
pList0.size() = 0
If you add m vectors to the vector, what's their indices?

I added m vectors at the end of the vector.

vector< vector<Vector3D> > pVector0;
pVector0.insert(pVector0.end(),m);
pVector0[m].push_back(pt3D);


V
 
H

hannibal200480

Jonathan said:
Hi everyone,

Here about what it is.

vector<vector<Point3D> > pVector0;

pVector0 is a vector of vector of 3D points.

pVector0 is a vector of 3D points.

pVector0[j] is a 3D point.

I wanted to add a point pt3D to the m vector in pVector0,



Are you sure this 'm' vector exists?

I have
write these two instructions which belong to a C++ program.

vector< vector<Vector3D> > pVector0;
pVector0[m].push_back(pt3D);


If that's the only 2 lines you wrote, there's a problem. The vector is
empty and you are trying to access it's mth element. Illegal.

If you want to add a point, you first need to add a vector of points.

std::vector<Vector3D> vector_of_points;
vector_of_points.push_back(a_point);

pVector0.push_back(vector_of_points);

Remember: pVector0 is a vector of vectors of points.


Jonathan

Thank you for your guys idea.

hannibal
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,770
Messages
2,569,583
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top