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. conversion from double datatype to pixel in VC++

conversion from double datatype to pixel in VC++

Scheduled Pinned Locked Moved C / C++ / MFC
c++
12 Posts 5 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 kindd

    i want to convert float and (/or) double data type into pixel. what would be the code for it.

    nill

    CPalliniC Offline
    CPalliniC Offline
    CPallini
    wrote on last edited by
    #2

    Usually a pixel is identified by the triple {X,Y, Color} each of the triple member can usually be represented using an int value. So, in principle, you cannot directly convert a double into a pixel. What do you really intend to do? :confused:

    If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.

    In testa che avete, signor di Ceprano?

    K 1 Reply Last reply
    0
    • CPalliniC CPallini

      Usually a pixel is identified by the triple {X,Y, Color} each of the triple member can usually be represented using an int value. So, in principle, you cannot directly convert a double into a pixel. What do you really intend to do? :confused:

      If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.

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

      basically i want to draw x and y cordinates from an access database , i m using double data type, i may have float, but to draw i want to have pixels. so i need that conversion logic.

      nill

      P T 2 Replies Last reply
      0
      • K kindd

        basically i want to draw x and y cordinates from an access database , i m using double data type, i may have float, but to draw i want to have pixels. so i need that conversion logic.

        nill

        P Offline
        P Offline
        Parthi_Appu
        wrote on last edited by
        #4

        So you are having X,Y points as double/float and those values are stored in a DB. Whts the problem now, typecast the values to 'int' and plot the detail. But i don't know, hw you get the Color value for the cooridinate as our pal mentioned in the previous post.


        Do your Duty and Don't expect the Result

        1 Reply Last reply
        0
        • K kindd

          basically i want to draw x and y cordinates from an access database , i m using double data type, i may have float, but to draw i want to have pixels. so i need that conversion logic.

          nill

          T Offline
          T Offline
          toxcct
          wrote on last edited by
          #5

          there's nothing logical in having floating point data types to store integers (moreover, such data types may loose the integers precision)... please explain clearly what you have, because it seems that no one here understand your need exactly.


          [VisualCalc][Binary Guide][CommDialogs] | [Forums Guidelines]

          K D 3 Replies Last reply
          0
          • T toxcct

            there's nothing logical in having floating point data types to store integers (moreover, such data types may loose the integers precision)... please explain clearly what you have, because it seems that no one here understand your need exactly.


            [VisualCalc][Binary Guide][CommDialogs] | [Forums Guidelines]

            K Offline
            K Offline
            kindd
            wrote on last edited by
            #6

            simple yet im drawing a picture by using double the x and y cordinates.but i need definite integers to draw. and wish to draw in pixels , the image is having million of x and y. so suggest what should i do to draw in pixels.

            nill

            T 1 Reply Last reply
            0
            • K kindd

              simple yet im drawing a picture by using double the x and y cordinates.but i need definite integers to draw. and wish to draw in pixels , the image is having million of x and y. so suggest what should i do to draw in pixels.

              nill

              T Offline
              T Offline
              toxcct
              wrote on last edited by
              #7

              kindd wrote:

              so suggest what should i do to draw in pixels.

              Using This[^] ?


              [VisualCalc][Binary Guide][CommDialogs] | [Forums Guidelines]

              1 Reply Last reply
              0
              • T toxcct

                there's nothing logical in having floating point data types to store integers (moreover, such data types may loose the integers precision)... please explain clearly what you have, because it seems that no one here understand your need exactly.


                [VisualCalc][Binary Guide][CommDialogs] | [Forums Guidelines]

                K Offline
                K Offline
                kindd
                wrote on last edited by
                #8

                simple yet im drawing a picture by using double the x and y cordinates.but i need definite integers to draw. and wish to draw in pixels , the image is having million of x and y. so suggest what should i do to draw in pixels.

                nill

                T 1 Reply Last reply
                0
                • K kindd

                  simple yet im drawing a picture by using double the x and y cordinates.but i need definite integers to draw. and wish to draw in pixels , the image is having million of x and y. so suggest what should i do to draw in pixels.

                  nill

                  T Offline
                  T Offline
                  toxcct
                  wrote on last edited by
                  #9

                  please delete this post, i already saw your answer and replied to you


                  [VisualCalc][Binary Guide][CommDialogs] | [Forums Guidelines]

                  1 Reply Last reply
                  0
                  • T toxcct

                    there's nothing logical in having floating point data types to store integers (moreover, such data types may loose the integers precision)... please explain clearly what you have, because it seems that no one here understand your need exactly.


                    [VisualCalc][Binary Guide][CommDialogs] | [Forums Guidelines]

                    D Offline
                    D Offline
                    David Crow
                    wrote on last edited by
                    #10

                    toxcct wrote:

                    there's nothing logical in having floating point data types to store integers (moreover, such data types may loose the integers precision)...

                    This sounds backwards. Floating point data types have more precision than integers so what exactly is being lost?


                    "Approved Workmen Are Not Ashamed" - 2 Timothy 2:15

                    "Judge not by the eye but by the heart." - Native American Proverb

                    T 1 Reply Last reply
                    0
                    • D David Crow

                      toxcct wrote:

                      there's nothing logical in having floating point data types to store integers (moreover, such data types may loose the integers precision)...

                      This sounds backwards. Floating point data types have more precision than integers so what exactly is being lost?


                      "Approved Workmen Are Not Ashamed" - 2 Timothy 2:15

                      "Judge not by the eye but by the heart." - Native American Proverb

                      T Offline
                      T Offline
                      toxcct
                      wrote on last edited by
                      #11

                      due to how floating point manage their memory, they don't store exact values but approximations. they can store larger numbers, but with less precision... knowing this, that's normal to encounter a 1.9999999999999 in a float we actually assigned a 2 i can't find the exact link to what i affirm, but i hope some here understand what i mean and can provide a relevant link.


                      [VisualCalc][Binary Guide][CommDialogs] | [Forums Guidelines]

                      D 1 Reply Last reply
                      0
                      • T toxcct

                        due to how floating point manage their memory, they don't store exact values but approximations. they can store larger numbers, but with less precision... knowing this, that's normal to encounter a 1.9999999999999 in a float we actually assigned a 2 i can't find the exact link to what i affirm, but i hope some here understand what i mean and can provide a relevant link.


                        [VisualCalc][Binary Guide][CommDialogs] | [Forums Guidelines]

                        D Offline
                        D Offline
                        David Crow
                        wrote on last edited by
                        #12

                        I see what you are saying, and I was thinking of something completely different. Yes, I'm familiar with floating-point issues (storage vs. usage). That aside, it just seems silly to store "pixel" numbers in a floating-point variable. They're never going to be anything but whole.


                        "Approved Workmen Are Not Ashamed" - 2 Timothy 2:15

                        "Judge not by the eye but by the heart." - Native American Proverb

                        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