Pixel Coordinates to Vectors
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 19/01/2006 at 16:04, xxxxxxxx wrote:
User Information:
Cinema 4D Version: 9.521
Platform: Windows ;
Language(s) : C++ ;---------
Hi guys,
Really new to the Cinema C++ SDK so please excuse the novice question But, in the BaseDraw class the GetFrame() and GetSafeFrame() member functions only return coordinates in Pixels which are of type LONG. If I wanted to create vectors from these coordinates would I use a static_cast<Real> and input these coordinates into the respective Vector component?
Thanks in advance for any help
-Josh- -
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 19/01/2006 at 17:41, xxxxxxxx wrote:
You could do that, but it depends on what you want. Pixels represent the 2D screen plane and the values have no direct correlation to the 3D world space. If you want the 3D world space coordinates that match the view's 2D screen plane coordinates, use BaseView::SW() (which is also available from BaseDraw as it is derived from BaseView). For this and your original question, yes, you cast the LONG to a Real as you show.
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 19/01/2006 at 22:45, xxxxxxxx wrote:
Thanks for the help Robert!
I am just testing out drawing wihtin the viewport, and what I would like to do is just draw a Line2D() from the world origin to the left-top corner of the viewport. Whats confusing is the result that BaseDraw::GetFrame() returns to the pointers. For example:LONG *leftFramePTR; LONG *topFramePTR; LONG *rightFramePTR; LONG *bottomFramePTR; bd->GetFrame(leftFramePTR, topFramePTR, rightFramePTR, bottomFramePTR);
Does this mean that leftFramePTR has the dimension of the left border of the viewport? Or is it just the coordinates of a single pixel in the top left corner?
Any simple examples you could show of BaseDraw::GetFrame() would be very helpful and much appreciated.
Thanks,
Josh -
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 20/01/2006 at 02:32, xxxxxxxx wrote:
a simple example would be to calculate the visible view-size:
LONG left, top, right, bottom; Real width, height; bd->GetFrame(&left;, ⊤, &right;, ⊥); width = right - left + 1; height = bottom - top + 1;