Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. vector in space

vector in space

Scheduled Pinned Locked Moved C / C++ / MFC
c++graphicsdata-structurestutorialquestion
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    khomeyni
    wrote on last edited by
    #1

    hello i want to define a vector with three or more parameter in space and as i know vector of stl only gets one parameter ,is there any header in stl or other library to solve this? also i have an array of points and i want to sort them on one axis ,how i can sort it with sort() of stl without any change to points? for example i used map for 2 dimension :map but when i set for example 11,12 11,13 it is false. thanks in advance.

    C 1 Reply Last reply
    0
    • K khomeyni

      hello i want to define a vector with three or more parameter in space and as i know vector of stl only gets one parameter ,is there any header in stl or other library to solve this? also i have an array of points and i want to sort them on one axis ,how i can sort it with sort() of stl without any change to points? for example i used map for 2 dimension :map but when i set for example 11,12 11,13 it is false. thanks in advance.

      C Offline
      C Offline
      Chris Losinger
      wrote on last edited by
      #2

      struct point3D
      {
      double x;
      double y;
      double z;
      };

      std::vector<point3D> my_vector_of_points;

      ?

      bool sortOnX(const point3D& a, const point3D& b)
      {
      return a.x < b.x;
      }

      std::sort(my_vector_of_points.begin(), my_vector_of_points.end(), sortOnX)

      image processing toolkits | batch image processing

      K 1 Reply Last reply
      0
      • C Chris Losinger

        struct point3D
        {
        double x;
        double y;
        double z;
        };

        std::vector<point3D> my_vector_of_points;

        ?

        bool sortOnX(const point3D& a, const point3D& b)
        {
        return a.x < b.x;
        }

        std::sort(my_vector_of_points.begin(), my_vector_of_points.end(), sortOnX)

        image processing toolkits | batch image processing

        K Offline
        K Offline
        khomeyni
        wrote on last edited by
        #3

        thanks a lot.

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups