weird problem...
Displaying 1-20 of 21 total.
12 next
Please enter a numerical value for the importance of this sticky.
Enter 0 to unsticky.
RageCage

this is basicly a problem being continued from http://verge-rpg.com/boards/display_thread.php?id=12343

my funct:

//r1 is the radius of the full circle
//r2 if the radius of the inside circle
void DrawHollowCircle(int x, int y, int r1, int r2, int color, int dest){
int i;
setLucent(75);

for(i=r2;i<=r1;i++){
circle(x, y, i, i, color, dest);
}

setLucent(0);
}

now it works fine as far as I can tell... untill r1 becomes greater than 9. the second it hits 10 or greater it starts doing that crazy shiznik in the linked post.

does anyone have a better way of making this hollowed circle or a reason/solution to what is happening?

Posted on 2004-04-27 13:32:18

vecna

I dont see the problems you showed in your original post, but that doesnt seem to be a very good way to draw a hollowed circle, this way is slower but it'll look a lot better:


//r1 is the radius of the full circle
//r2 if the radius of the inside circle
void DrawHollowCircle(int x, int y, int r1, int r2, int color, int dest)
{
int timg = NewImage(r1*2+1, r1*2+1);
RectFill(0, 0, r1*3, r1*3, transcolor, timg);
CircleFill(r1, r1, r1, r1, color, timg);
CircleFill(r1, r1, r2, r2, transcolor, timg);

setLucent(75);
TBlit(x-r1, y-r1, timg, dest);
FreeImage(timg);
setlucent(0);
}

Posted on 2004-04-27 18:30:14

Gayo

Yeah, you should never try to it that way -- you're liable to get holes.

Posted on 2004-04-28 00:01:40

RageCage

ok well I integreated your funct into my game and, although it seems to work at first, I am getting the weird bug again.


wtf is that thing? I have no idea why this is happening...

Posted on 2004-04-28 02:08:39 (last edited on 2004-04-28 03:11:04)

RageCage

OK! I figured it out! it's indeed a bug.
I recreated the event completely without any crap around it...


that is a circle with the radius at 550. if I set the radius to 500 it works fine. maybe you took measures to optimize by thinking no one would ever need this big of a circle?

Posted on 2004-04-28 03:21:30

mcgrue

That is what we in the 'business' call 'a nipple'.

For more information on 'nipples' check the rest of the internet.

Posted on 2004-04-28 04:04:36

RageCage

lol, yeah I was thinking the same thing... actually if you use 750 you get a full flopping boob shape =p

Posted on 2004-04-28 04:32:07

vecna

Well, its not .. exactly.. a bug so much as an... artifact. Ok, I'm splitting hairs.

There's no bug, there's no sneaky optimization, it appears to just be a limit to how good of a circle you can draw using certain algorithms of integer math.

I'm curious... what ARE you using a circle this big for? ^_^

I can replace it with a different algorithm, but, I gotta say, right now, it doesnt seem like a terribly high priority item.

Posted on 2004-04-28 05:39:41

RageCage

the reason I'm using this big of a circle is because I'm not so much drawing them to the screen as I am drawing them to the map... the x an y are dependant of the xwin and ywin. Its my whole radius based tactics system here =p

if this is really a much faster/better algorithm, then dont let me make you get rid of it. I'm sure I can probably just resize a pre-drawn circle or something.

Posted on 2004-04-28 12:44:26

mcgrue

Didn't zero or aen or someone spend like a gajillion hours making the one circle algo to rule them all (and in the darkness bind them)?

Posted on 2004-04-28 12:46:31

vecna

aen did. I should bug him.

However, I know for a fact that he was testing for 1) simplicity of code 2) ability to have 'perfect' _small_ circles, and circles with odd numbered widths. I do NOT believe he even looked at gigantic circles.

As for me, I tested the circle routine as being big able to make circles to fill the screen - eg circle out/in effect - and it does. I didnt really anticipate someone drawing a circle gigantically huger than the screen and only showing one side of it.

Posted on 2004-04-28 13:01:13

Troupe

Stop making excuses and add it to your list of things to fix, you evil, evil man. Actually, I know you're really busy, so get aen to put his algorithm in. But we need big cirlces for our game! Don't make us suffer.

Posted on 2004-04-28 14:11:09

Gayo

This could be problematic once we start getting 1024x768 VERGE games!


....


Problematic!

Posted on 2004-04-29 01:20:22

RageCage

indeed, as is mine

Posted on 2004-04-29 01:52:46

aen

Luckily, andy had a copy of my routines lying around! He says he uses it in ika even, neat-o. Not sure if it's the ultra perfect version I finally ended up with -- I remember tweaking it a bit more after giving it to him. I'll probably test it further this weekend to make sure.

At any rate, the primary focus was on symmetry. I of course also wanted to be able to specify the oval size in the same way a rectangle is specified, with the oval fitting exactly within its bounds. I needed it for a tile plotting tool, and so I felt precision was important. Especially at small sizes. I don't think it produces 100% mathematically perfect ovals, but the results are pretty damn close. I'm also fairly certain it (or at least the perfect version) doesn't produce gaps at any size.

Here it is, in both outline and filled forms: aen_ellipse2.java.txt

Posted on 2004-04-30 02:04:23 (last edited on 2004-04-30 02:06:51)

aen

Just tinkered around in VC and ported it myself. Don't ask me why I have that -1 check in HLine, it's another one of those "I intuitively somehow knew that would fix it but who the hell knows why" kind of things. Without it the right edge of the ellipse is too thick for small ellipses. Off-by-one somewhere, at any rate.

Here it is in action: ellipse_demo.vc

Posted on 2004-04-30 03:07:20

aen

Put the filled version in there now too. Same file.

Also! Be mindful of that "b2" variable if you're dealing with this code. There is of course already a variable by this name built in, so I renamed all instances to "bb2". I was scratching my head for a while at some pretty awful ellipses until I realized I had missed one or two of them.

Posted on 2004-04-30 03:23:00 (last edited on 2004-04-30 03:26:27)

RageCage

kick ass, I'll be tryin this out next chance I get
thanks a lot

Posted on 2004-04-30 04:28:06

RageCage

sweet, it sure does work.
unfortunately you made me have to go though and add a color and destImage to everything and the functions work differently than the library ones... but its only a minor setback.

thanks a lot!

Posted on 2004-05-01 00:37:44

aen

But don't you feel better as a person having accomplished it by yourself? I can't go forking over ALL of my ultimate and shining brilliance, now can I! Someone's gotta keep you slackers on your toes. And I have several degrees in the Keeping Onning of Toes, Elbow Engreasement, and Keyboard to Foreheadery. Watch me spring into action at a moment's notice!

Code over here! *ba-BLAM!*

Code over there! *ka-POW!!*

Whodat, Elvis? *points* CODE IN YA TROUSERS, FOO! *sha-ZIZZAM!!!*

...Glad it's useful though. ^_-

Posted on 2004-05-01 05:04:46


Displaying 1-20 of 21 total.
12 next
 
Newest messages

Ben McGraw's lovingly crafted this website from scratch for years.
It's a lot prettier this go around because of Jon Wofford.
Verge-rpg.com is a member of the lunarnet irc network, and would like to take this opportunity to remind you that regardless how babies taste, it is wrong to eat them.