conversion from double datatype to pixel in VC++
-
i want to convert float and (/or) double data type into pixel. what would be the code for it.
nill
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 adouble
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.
-
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 adouble
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.
-
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
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
-
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
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]
-
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]
-
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
kindd wrote:
so suggest what should i do to draw in pixels.
[VisualCalc][Binary Guide][CommDialogs] | [Forums Guidelines]
-
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]
-
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
please delete this post, i already saw your answer and replied to you
[VisualCalc][Binary Guide][CommDialogs] | [Forums Guidelines]
-
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]
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
-
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
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]
-
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]
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