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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T13:31:45+00:00 2026-06-11T13:31:45+00:00

I am trying to get familiar with boost::geometry::point . In my class I have

  • 0

I am trying to get familiar with boost::geometry::point. In my class I have a default constructor with no parameters and I want to initialize in this case all point values with zero.

As the set/get functions are templates, the following code part would yield an error at compile time:

    for( std::size_t i = 0; i < pnt.size() ; i++ )
    {
        pnt.set<i>( 0.0 );
    }

To refer the documentation http://www.boost.org/doc/libs/1_51_0/libs/geometry/doc/html/geometry/reference/models/model_point.html

I need to set some values because:

Coordinates are not initialized. If the constructor with parameters is not called and points are not assigned using set or assign then the coordinate values will contain garbage.

Is there a way to initialize all values with zero at compile time? If not then at runtime?

  • 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-11T13:31:46+00:00Added an answer on June 11, 2026 at 1:31 pm

    You can use assign_zero or assign_values (this one only works for 2, 3 and 4 components):

    boost::geometry::assign_zero(pnt);
    boost::geometry::assign_values(pnt, 0.0, 0.0);
    

    If you are using a custom point class you need to register it using one of the BOOST_GEOMETRY_REGISTER_POINT... in order to be able to use Boost Geometry functionality. You can find several examples here.

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

Sidebar

Related Questions

I'm trying to get familiar with Collections. I have a String which is my
I'm trying to get familiar with CI and I have run into a problem
I'm getting trying to get familiar with Zend and have a question that's probably
I'm trying to get familiar with Git having only SVN prior experience. I have
I'm trying to get more familiar with AJAX, and web services, so I have
Coming from web development I have been trying to get familiar with compiled programming,
I'm trying to get familiar with ViewPager. My code is given below. The problem
I'm trying to get familiar with the whole keyboard event detection thing. Here's my
I'm trying to get familiar with PHPUnit testing within Kohana. At the moment, I
I've been trying to get familiar with JNI and its functionality. I am trying

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.