|
Author |
Topic: Re: Round in circles (Read 1599 times) |
|
kurol
|
Re: Round in circles
« on: Mar 29th, 2005, 12:00pm » |
|
LOOKIE WHAT I MADE, MOMMY!!! I'm not quite sure what your intention is, because you said, "I'm trying to get a line draw working within the confines of a circle," and the example code kind of usually sticks to the outside. But here's one thing: Code:if (sqrt(sq(width/2-xl) + sq(height/2 - yl)) > cDia/2) { |
| can be replaced by Code:if (dist(width/2,height/2,xl,yl) > cDia/2) { |
|
|
I hate programming . . .
|
|
|
Mark Hill
|
Re: Round in circles
« Reply #1 on: Mar 29th, 2005, 12:15pm » |
|
Thanks for the input. I know what the code produces, which is I why I posted the question in the first place. I'm interested in registering an influence of the confining shape upon the line being drawn. Restricting the drawing to within the confines of a circle is achieved thus: Code: xl = mouseX-width/2; yl = mouseY-height/2; i = atan2(mouseY-height/2, mouseX-width/2); if (dist(0,0,xl,yl) > r) { // yep, it works! xl = r * cos(i); yl = r * sin(i); } |
|
|
|
|
|
Mark Hill
|
Round in circles
« Reply #2 on: Mar 29th, 2005, 12:22pm » |
|
Deleted original post instead of modify, sorry.
|
« Last Edit: Mar 29th, 2005, 12:22pm by Mark Hill » |
|
|
|
|
|