<p>I think you should transform your coordinates before checking if they touch the boundary. You seem to use a scatter approach and every pixel that touch the non-transformed ellipse will land on only one pixel. Because the number of pixels that touch the boundary are &quot;uniform&quot; along curves that correspond to a rotated pixel grid, you will get holes and clusters which you can see in your zoomed in example.</p>

CC BY-SA 4.0
2023-04-11T20:54:15.923Z
hi @Mathis thank you for the answer <3
0x00001F
CC BY-SA 4.0
2023-04-11T21:15:43.877Z
i want to give +1 but i can't for now :(
0x00001F
CC BY-SA 4.0
2023-04-09T08:55:19.993Z
2023-04-09T08:55:19.993Z
Mathis
<p>i'am a junior in computer graphics , currently i learn how to draw ellipses with rotation .</p>
<p>when i preform rotation with 90deg or 180deg nothing unusual happened ,
but when i try to rotate with any other value the result will be like this :</p>
<p><a href="https://i.sstatic.net/lX7YK.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/lX7YK.png" alt="enter image description here" /></a></p>
<p>here's a pseudo-code of what iam doing , i didn't put the original function because it's huge .</p>
<pre><code>function draw_circle( x_origin , y_origin , width , height ){

// go in scan-line order and try to find intercept x,y around the ellipse
   for( y = 0 ; y &lt;= height ; y++ ){   

       for( x = width  ; x &gt;= 0; x-- ){

            // when we find point x , y
            if( ( x*x / width ) + ( y*y / height  ) &lt;= 1 ){

                  // rotate a copy of x,y
                  rotate_z( x , y , by_angle );

                  // draw the rotate x,y copy
                  set_pixle( x_origin + x , y_origin + y );
                   
                  /*
                     then preform reflection in the other side 
                     of the ellipse 
                  */
            }

       }
   }
}
</code></pre>

CC BY-SA 4.0
2023-04-09T04:53:37.850Z
Welcome to computer graphics stack exchange. To help you find out how to fix the eclipse rotation bug, we need more information about how you have implemented it. An idial way to help us helping you is to provide some code and tell us, what you have tried so far. Otherwise we only can guess.
Thomas
CC BY-SA 4.0
2023-04-09T08:25:09.167Z
hello @Thomas , and thanks for the comment , i didn't put the original function because it's huge but i put a pseudo-code instead :)
0x00001F
CC BY-SA 4.0
2023-04-09T18:25:38.960Z
Not enough info.
joojaa
CC BY-SA 4.0
2023-04-11T21:14:48.160Z
hi @joojaa what's missing , i can add it .
0x00001F
<2d><drawing>
drawing ellipse with rotation cause inaccurate result
0x00001F
# drawing ellipse with rotation cause inaccurate result

(Asked by: username_0 on 2023-04-09)

i'am a junior in computer graphics , currently i learn how to draw ellipses with rotation .

when i preform rotation with 90deg or 180deg nothing unusual happened ,
but when i try to rotate with any other value the result will be like this :

[![enter image description here](https://i.sstatic.net/lX7YK.png)](https://i.sstatic.net/lX7YK.png)

here's a pseudo-code of what iam doing , i didn't put the original function because it's huge .

```
function draw_circle( x_origin , y_origin , width , height ){

// go in scan-line order and try to find intercept x,y around the ellipse
   for( y = 0 ; y <= height ; y++ ){   

       for( x = width  ; x >= 0; x-- ){

            // when we find point x , y
            if( ( x*x / width ) + ( y*y / height  ) <= 1 ){

                  // rotate a copy of x,y
                  rotate_z( x , y , by_angle );

                  // draw the rotate x,y copy
                  set_pixle( x_origin + x , y_origin + y );
                   
                  /*
                     then preform reflection in the other side 
                     of the ellipse 
                  */
            }

       }
   }
}

```

**Tags:** 2d, drawing

> **Comments:**
> **username_1**: Welcome to computer graphics stack exchange. To help you find out how to fix the eclipse rotation bug, we need more information about how you have implemented it. An idial way to help us helping you is to provide some code and tell us, what you have tried so far. Otherwise we only can guess.  
> **username_0**: hello @username_1 , and thanks for the comment , i didn't put the original function because it's huge but i put a pseudo-code instead :)  
> **username_2**: Not enough info.  
> **username_0**: hi @username_2 what's missing , i can add it .  

---

## 1 answers

### Answer by username_3 on 2023-04-09. Score: 1

I think you should transform your coordinates before checking if they touch the boundary. You seem to use a scatter approach and every pixel that touch the non-transformed ellipse will land on only one pixel. Because the number of pixels that touch the boundary are "uniform" along curves that correspond to a rotated pixel grid, you will get holes and clusters which you can see in your zoomed in example.

> **Comments:**
> **username_0**: hi @username_3 thank you for the answer <3  
> **username_0**: i want to give +1 but i can't for now :(  

---

