data coordinates thickness [message #90275] |
Wed, 18 February 2015 07:46  |
Helder Marchetto
Messages: 520 Registered: November 2011
|
Senior Member |
|
|
Hi,
I'm drawing objects (polygon(), ellipse(), polyline()) on an image. The image has a specific data coordinates.
I *assume* that the thickness of a line is defined in device coordinates. Is there a way to get the thickness of a line in data coordinates?
Of course an approximation would be enough.
One way, would be to use the ConvertCoord method as such:
zero = obj->ConvertCoord(0, 0, /data, /to_device)
one = obj->ConvertCoord(dataThickness, 0, /data, /to_device)
deviceThickness = one[0]-zero[0]
The assumption behind this is that the thickness is drawn in device coordinates. I guess this might be true for non zero values of the thickness (hairline) and maybe even for thicknesses of 1.
Can anybody confirm or correct the above statements?
Thanks,
Helder
|
|
|
Re: data coordinates thickness [message #90279 is a reply to message #90275] |
Wed, 18 February 2015 08:27   |
Helder Marchetto
Messages: 520 Registered: November 2011
|
Senior Member |
|
|
On Wednesday, February 18, 2015 at 4:46:20 PM UTC+1, Helder wrote:
> Hi,
> I'm drawing objects (polygon(), ellipse(), polyline()) on an image. The image has a specific data coordinates.
> I *assume* that the thickness of a line is defined in device coordinates. Is there a way to get the thickness of a line in data coordinates?
> Of course an approximation would be enough.
>
> One way, would be to use the ConvertCoord method as such:
>
> zero = obj->ConvertCoord(0, 0, /data, /to_device)
> one = obj->ConvertCoord(dataThickness, 0, /data, /to_device)
> deviceThickness = one[0]-zero[0]
>
> The assumption behind this is that the thickness is drawn in device coordinates. I guess this might be true for non zero values of the thickness (hairline) and maybe even for thicknesses of 1.
>
> Can anybody confirm or correct the above statements?
>
> Thanks,
> Helder
I just noticed that the maximum thickness is 10 (pixels?)... darn... I need something else and it's going to be difficult. Why limit to 10?
Cheers,
Helder
|
|
|
Re: data coordinates thickness [message #90285 is a reply to message #90279] |
Wed, 18 February 2015 10:15  |
chris_torrence@NOSPAM
Messages: 528 Registered: March 2007
|
Senior Member |
|
|
On Wednesday, February 18, 2015 at 9:27:48 AM UTC-7, Helder wrote:
> On Wednesday, February 18, 2015 at 4:46:20 PM UTC+1, Helder wrote:
>> Hi,
>> I'm drawing objects (polygon(), ellipse(), polyline()) on an image. The image has a specific data coordinates.
>> I *assume* that the thickness of a line is defined in device coordinates. Is there a way to get the thickness of a line in data coordinates?
>> Of course an approximation would be enough.
>>
>> One way, would be to use the ConvertCoord method as such:
>>
>> zero = obj->ConvertCoord(0, 0, /data, /to_device)
>> one = obj->ConvertCoord(dataThickness, 0, /data, /to_device)
>> deviceThickness = one[0]-zero[0]
>>
>> The assumption behind this is that the thickness is drawn in device coordinates. I guess this might be true for non zero values of the thickness (hairline) and maybe even for thicknesses of 1.
>>
>> Can anybody confirm or correct the above statements?
>>
>> Thanks,
>> Helder
>
> I just noticed that the maximum thickness is 10 (pixels?)... darn... I need something else and it's going to be difficult. Why limit to 10?
>
> Cheers,
> Helder
Hi Helder,
I'm not sure why the maximum is 10. Maybe because no one ever asked for more? Anyway, a better solution might be to use a polygon if you want to draw a really "thick" line. That way you have total control over the coordinates, and you can use things like ConvertCoord to calculate the thickness.
-Chris
|
|
|