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 4115842
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T22:38:04+00:00 2026-05-20T22:38:04+00:00

Possible Duplicate: How to pass objects to functions in C++? My main program gives

  • 0

Possible Duplicate:
How to pass objects to functions in C++?

My main program gives me coefficient of plane equation as a vector.

I have many planes and I am trying to find out their intersections. So, I have series of plane parameters, belongs to each plane and I have created a map to accommodate plane parameters and I gave a key as plane number. Now, I am calling planes according to randomly given order (that is why, I use map). So, for each time I am using two planes to compare whether they intersect or not.

My function:

vector<double> intersection_vector(vector<double> plane1,vector<double> plane2){
    vector<double> cross_product;
    double a1=plane1.at(0);
    double b1=plane1.at(1);
    double a2=plane2.at(0);
    double b2=plane2.at(1);
    //double d1=plane1.at(2);
    //double d2=plane2.at(2);
    int c1=-1,c2=-1;
    double cross_a=(b1*c2)-(b2*c1);
    double cross_b=(a2*c1)-(a1*c2);
    double cross_c=(a1*b2)-(a2*b1);
    cross_product.push_back(cross_a);cross_product.push_back(cross_b);cross_product.push_back(cross_c);
    return cross_product;
    }

Main program:

//some codes

map<int, vector<int> >::iterator xx;
for (xx=parameter_list.begin();xx!= parameter _list.end();xx++){
       int my_plane=xx->first;
       vector <int> your_planes=xx->second;
       for(int i=0; i< your _planes.size();i++){        
                   int any_ your _plane= your _planes.at(i);
        vector <double>edge_line=intersection_vector(my_plane, any_ your _plane);

       // do something

Now, I want to use pointers and references to speed up this process. Please help me while explaining why use * and & for respective places. (Maybe I need call by reference or something else and what I did is call by value? Is that, plase explain because, I do not have basic on this).

  • 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-05-20T22:38:04+00:00Added an answer on May 20, 2026 at 10:38 pm

    If you want to learn when to use pointers or references I strongly recommend you read “Effective C++” and “More Effective C++” by Scott Meyers. They are both excellent books that will give you a deep understanding of how to write good C++ code.

    I’m sure they’re available on Amazon.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Possible Duplicate: FAQ : How to pass objects to functions in C++? Pointer vs.
Possible Duplicate: Can't pass mysqli connection in session in php Many of us have
Possible Duplicate: How to pass objects to functions in C++? Operator & and *
Possible Duplicate: pass data from Action To Another Action I have a view in
Possible Duplicate: Is Java pass by reference? I have a question about passing by
Possible Duplicate: How to pass an array via $_GET in php? So I have
Possible Duplicate: Is Java pass-by-reference? Java pass by reference For the following Java program,
Possible Duplicates: “const T &arg” vs. “T arg” How to pass objects to functions
Possible Duplicates: How to pass objects to functions in C++? is there any specific
Possible Duplicate: Is it possible to pass parameters by reference using call_user_func_array()? I have

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.