How to cast a Rect to a Rect2d ?

asked 2019-07-24 10:06:26 -0600

Rafutek gravatar image

updated 2019-07-25 02:09:28 -0600

Hello,

Is there a simple way to cast a Rect to a Rect2d in Java?

Thanks

edit retag flag offensive close merge delete

Comments

1

What have you try?

    Rect r(10, 20, 30, 40);
    Rect2d rr(r);
    Rect2d rrr = static_cast<Rect2d>(r);
LBerger gravatar imageLBerger ( 2019-07-24 10:42:52 -0600 )edit

Sorry I forgot to specify in Java, I did:

Rect rect = new Rect(10, 20, 30, 40);
Rect2d box = new Rect2d(rect.x, rect.y, rect.width, rect.height);

Let me know if you have a better solution

Rafutek gravatar imageRafutek ( 2019-07-25 02:20:54 -0600 )edit