Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8672909
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T19:19:13+00:00 2026-06-12T19:19:13+00:00

The following is a class that I have done to divide a bounding box

  • 0

The following is a class that I have done to divide a bounding box into smaller pieces.

class reticula
{   
    int _columnas;
    int _renglones;
    int _num_pixelotes;
    vector<vector<Point> > Pixelotes;

public:
reticula():
_columnas(0),
_renglones(0),
_num_pixelotes(0),
Pixelotes(){};
/// crear la reticula con los valores deseados 
reticula(vector<Point> verticesB, int renglon, int columna);

Size size(void);
vector<Point> en(int el_renglon, int la_columna);
~reticula(void);
};  

reticula::reticula(vector<Point> verticesB, int renglon, int columna ){
if(verticesB.size()!= 4){
    cout<< "El vector debe tener las 4 esquinas del rectangulo a dividir"
        << endl;    
    throw 400; // es para mandar la exepción. 
}
_columnas = columna;
_renglones = renglon;
_num_pixelotes = columna * renglon ;
Pixelotes.resize(_renglones * _columnas); 
double dis_mayor, dis_menor;//con respecto a los ejes 
Point dif_10;
Point dif_21;
Point dif_32;
Point dif_03;
double es_mayor, es_menor;


dif_10 = verticesB[1]-verticesB[0];
dif_21 = verticesB[2]-verticesB[1];
dif_32 = verticesB[3]-verticesB[2];
dif_03 = verticesB[0]-verticesB[3];

dis_mayor = norm(dif_10);
dis_menor = norm(dif_21);

es_mayor = dis_mayor/(double) _columnas;
es_menor = dis_menor/(double) _renglones;
Point aux;
Point aux2;
vector<Point> vertices_re((_columnas + 1)*(_renglones + 1));
for (int i = 0; i < _renglones; i++){
    for(int j= 0; j < _columnas; j++){
        for(int h=0; h < 4; h++ ){
            aux = verticesB[0] + ((((double)j*dis_mayor) * dif_10) + (((double)i * dis_menor)*dif_21));
            if(h=0){aux2= aux;}
            else if(h=1){aux2= aux + (dis_mayor * dif_10);}
            else if(h=2){aux2= aux + (dis_mayor * dif_10) + (dis_menor * dif_21);}
            else if(h=3){aux2= aux + (dis_menor * dif_21);}
            Pixelotes[i * _columnas + j].push_back(aux2);
        }
    }
}


}


Size reticula::size(void){
Size Total;
Total.width = _columnas;
Total.height = _renglones;
return Total;

}

vector<Point> reticula::en(int el_renglon, int la_columna){
if(el_renglon > _renglones|| la_columna> _columnas){
    cout << " el renglon y la columna se deben encontrar dentro de los parametros "
        <<endl;
    cout<< _renglones<<" , "<<_columnas<<endl;
    vector<Point> vacio;
    vacio.push_back(Point(0,0));
    return (vacio);
}
int busca;
busca = el_renglon * _columnas + la_columna;    
}

And I want to create a vector that contain this class but I don’t know what I’m doing wrong

vector<reticula> SoloReti(contours.size());
for(int g=0; g< SoloReti.size(); g++){
    SoloReti[g].reticula(contours[g], 5,4);
}

The g++ compiler tells “invalid use of reticula::reticula” can someone tell me where the problem is ?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T19:19:14+00:00Added an answer on June 12, 2026 at 7:19 pm

    When you declare your vector<reticula> SoloReti(contours.size()), it initializes the vector with contours.size() reticula build with default constructor reticula().

    When you do SoloReti[g].reticula, you are trying to call the constructor from an already constructed object. Solution: use assignment operator:

    vector<reticula> SoloReti(contours.size());
    for(int g=0; g< SoloReti.size(); g++){
        SoloReti[g] = reticula(contours[g], 5,4);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a class that looks like the following: public class MyClass { private
We have a class a class that looks something like the following: public class
Assume that we have the following code: class Program { static volatile bool flag1;
I have an ExpenseType object that I have created with the following migration: class
Given that I have the following WCF service: class LookUpService { public List<County> GetCounties(string
Lets say that I have the following code: public class Shelter<A extends Animal, B
I have the following class written by someone else that I'm trying to understand
So I have a class that has the following member variables. I have get
I have a class that has the following property that is generated by the
I have the following methods in my Authentication class that is called by my

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.