Desenhando Círculos em NCL/Lua

December 11, 2009

Implementei uma função que permite desenhar circulos com o Canvas para NCL/Lua

Função


function desenharCirculo ( X0 , Y0 , raio , mode )
function converterGrau2Rad ( x )
return ( x / 180 ) * math.pi
end

local tblPt = {}

if mode ~= ‘fillthen
mode = ‘frame
end

for i=0, 360 do
local x = (raio * math.cos(converterGrau2Rad(i)))
local y = (raio * math.sin(converterGrau2Rad(i)))

if mode == ‘framethen
tblPt[i] = {}
table.insert(tblPt[i],X0 – x)
table.insert(tblPt[i],Y0 – y)
end

if mode == ‘fillthen
canvas:drawLine (X0, Y0, X0 – x, Y0 – y)
end

end

if mode == ‘framethen

for i=0, table.maxn(tblPt) do

if i == table.maxn(tblPt) then
canvas:drawLine (tblPt[i][1], tblPt[i][2], tblPt[0][1], tblPt[0][2])
else
canvas:drawLine (tblPt[i][1], tblPt[i][2], tblPt[i+1][1], tblPt[i+1][2])
end

end

end

end

A chamada para a função é a seguinte:

canvas:attrColor(96, 181, 255, 255)
desenharCirculo ( 250 , 250 , 20 , ‘frame’ )
canvas:flush()

Parâmetros
A função trabalha com quatro parâmetros, são eles:
X0: A coordenada X do ponto central.
Y0: A coodenada Y do ponto central.
Raio: O tamanho do raio do círculo.
Mode: É o tipo de desenho que será feito. Se escolhido frame, será desenhado apenas a moldura. Se for escolhido fill o desenho será preenchido. O modo frame é utilizado como default.

Problemas
Nem tudo na vida é perfeito e esta função não seria diferente. Quando desenhamos um círculo com mode fill e raio muito grande, vemos algumas falhas. Se alguém conseguir solucionar o problema, escreva nos comentários que a função será atualizada e dado os devidos créditos. :)

60 Responses to “Desenhando Círculos em NCL/Lua”

  1. o problema com certeza está aki "for i=0, 360 do" com passo 1 vc vai pegar so as posições de grau exato, e qdo vc aumenta muito o pixel do grau exato não vai cobrir todo espaço necessário, então ou vc diminui o passo para 0,1 para pegar mais posições ou limita um raio maximo ..

  2. Marcelo você está completamente certo.

    A partir do momento que eu vario o passo do for, aumento a precisão.

    Quando maior a precisão, melhor o resultado final, maior o processamento.

    Eu inclui uma atualização desta função no meu site pessoal: http://luizeduardoaraujo.info/?p=277

    [[]]'s

  3. This info is worth everyone’s attention. When can I find out more?|

  4. I am actually grateful to the holder of this web page who has shared this fantastic article at at this time.|

  5. Hi, i think that i saw you visited my web site so i came to “return the favor”.I am attempting to find things to enhance my web site!I suppose its ok to use some of your ideas!!|

  6. Hi there to all, how is the whole thing, I think every one is getting more from this web page, and your views are pleasant in favor of new users.|

  7. I simply couldn’t go away your site prior to suggesting that I actually enjoyed the usual info a person supply for your guests? Is going to be again incessantly to investigate cross-check new posts|

  8. Truly when someone doesn’t understand after that its up to other people that they will help, so here it happens.|

  9. Hello my loved one! I wish to say that this post is amazing, great written and come with almost all significant infos. I¡¦d like to look extra posts like this .

  10. Hello! Would you mind if I share your blog with my twitter group? There’s a lot of folks that I think would really appreciate your content. Please let me know. Thanks|

  11. When someone writes an piece of writing he/she keeps the idea of a user in his/her brain that how a user can understand it. So that’s why this paragraph is great. Thanks!|

  12. Many of us extended the visible profile associated with licensed manufacturers together with men’s as well as ladies’ panties licenses intended for Columbia Sportswear, some sort of sleepwear and intimates licenses pertaining to Juicy Couture, and also a unique license pertaining to The puma company sportswear brand name merchandise inside Israel – tending to give rise to our own expansion prospective inside future years.

  13. Wonderful blog! I found it while browsing on Yahoo News. Do you have any tips on how to get listed in Yahoo News? I’ve been trying for a while but I never seem to get there! Appreciate it|

  14. Hello There. I found your blog using msn. This is a very well written article. I will make sure to bookmark it and return to read more of your useful info. Thanks for the post. I’ll certainly comeback.|

  15. What’s up, I log on to your new stuff regularly. Your writing style is witty, keep it up!|

  16. I’m now not positive where you are getting your information, but good topic. I must spend some time studying much more or working out more. Thank you for wonderful information I used to be looking for this info for my mission.|

  17. We’re a group of volunteers and starting a new scheme in our community. Your site provided us with valuable info to work on. You have done a formidable job and our entire community will be thankful to you.

  18. I’m still learning from you, but I’m trying to achieve my goals. I absolutely love reading everything that is written on your website.Keep the information coming. I loved it!

  19. Hey would you mind letting me know which web host you’re utilizing? I’ve loaded your blog in 3 completely different browsers and I must say this blog loads a lot faster then most. Can you suggest a good web hosting provider at a honest price? Kudos, I appreciate it!|

  20. Wow! Thank you! I continually wanted to write on my blog something like that. Can I implement a portion of your post to my blog?

  21. I have been reading out a few of your posts and i can claim pretty nice stuff. I will make sure to bookmark your site.

  22. It’s a shame you don’t have a donate button! I’d certainly donate to this fantastic blog! I guess for now i’ll settle for bookmarking and adding your RSS feed to my Google account. I look forward to brand new updates and will talk about this blog with my Facebook group. Chat soon!

  23. Great remarkable things here. I¡¦m very happy to see your post. Thanks a lot and i am taking a look forward to touch you. Will you kindly drop me a mail?

  24. It is really a great and helpful piece of information. I am glad that you shared this helpful info with us. Please stay us informed like this. Thank you for sharing.

  25. There is evidently a bundle to know about this. I feel you made certain nice points in features also.

  26. Hello my friend! I wish to say that this post is amazing, great written and come with approximately all important infos. I would like to peer extra posts like this .

  27. You made a number of nice points there. I did a search on the theme and found nearly all folks will go along with with your blog.

  28. Unquestionably believe that which you said. Your favorite reason seemed to be on the net the easiest thing to be aware of. I say to you, I certainly get irked while people consider worries that they just don’t know about. You managed to hit the nail upon the top as well as defined out the whole thing without having side effect , people could take a signal. Will likely be back to get more. Thanks

  29. What i don’t realize is in reality how you’re not really a lot more smartly-preferred than you might be right now. You’re so intelligent. You realize therefore considerably with regards to this subject, produced me in my view believe it from so many varied angles. Its like men and women are not involved except it¡¦s one thing to do with Lady gaga! Your own stuffs great. All the time deal with it up!

  30. Good day very cool site!! Man .. Excellent .. Amazing .. I’ll bookmark your website and take the feeds additionally¡KI am glad to find a lot of useful info right here in the submit, we’d like develop more techniques on this regard, thank you for sharing. . . . . .

  31. Hiya, I am really glad I have found this information. Today bloggers publish just about gossips and net and this is really annoying. A good website with interesting content, that is what I need. Thank you for keeping this web site, I will be visiting it. Do you do newsletters? Can’t find it.

  32. I precisely desired to appreciate you all over again. I am not sure the things that I could possibly have tried in the absence of the actual solutions shared by you relating to such topic. It previously was a very horrifying concern in my view, but looking at a skilled manner you managed it forced me to jump over contentment. I’m grateful for this support and as well , hope that you really know what a powerful job you’re getting into training other individuals through the use of your web page. More than likely you haven’t got to know any of us.

  33. hello!,I really like your writing so so much! percentage we keep in touch more about your article on AOL? I need an expert on this space to unravel my problem. May be that is you! Having a look forward to see you.

  34. You made certain fine points there. I did a search on the subject and found mainly people will have the same opinion with your blog.

  35. I cherished as much as you will obtain performed right here. The cartoon is tasteful, your authored material stylish. however, you command get got an nervousness over that you want be turning in the following. sick undoubtedly come more beforehand again as exactly the same just about very frequently within case you defend this increase.

  36. Quality content is the main to interest the visitors to go to see the web page, that’s what this site is providing.

  37. I really like the whole post. Many thanks for giving this excellent tips. I am excited now and going to check out old posts.

  38. Thank you, I’ve recently been looking for information approximately this topic for a while and yours is the greatest I’ve discovered so far. However, what concerning the conclusion? Are you certain concerning the source?

  39. Hey there, You’ve performed a great job. I’ll definitely digg it and in my view recommend to my friends. I am confident they’ll be benefited from this website.

  40. Hello.This article was really remarkable, especially since I was searching for thoughts on this topic last week.

  41. whoah this blog is great i love reading your articles. Keep up the great work! You realize, many persons are searching around for this info, you can help them greatly.

  42. Nice blog right here! Also your site so much up fast! What host are you using? Can I am getting your associate link for your host? I desire my website loaded up as quickly as yours lol

  43. Valuable info. Fortunate me I found your site unintentionally, and I’m stunned why this accident did not took place in advance! I bookmarked it.

  44. I uncovered your blog website on google and also inspect a few of your very early blog posts. Continue to maintain the great run. I simply additional up your RSS feed to my MSN Information Viewers. Seeking onward to learning more from you in the future!?

  45. my wife and I are lucky to have stumbled across this forum, it is really the thing my wife’s friendsMy friends from work are looking in search of. The information on this web page is with out a doubt enlightening and will contribute my friends from church and I a bunch productive help. From what I see the site acquired a large amount of specific details about subjects on the site and categories of topics and info also are shown. I’m not usually on the internet all of the time but when I get an opportunity I am all the way into deeply studying this type of information and stuff similarly concerning it. Cheers. If anyone needed a bit of helpful services like: [url=https://keenerlegal.com/patent-lawyer/]trademark infringement attorneys[/url] and [url=https://www.gotwebsite1.com/sedona-seo/index.html]seo for photographers[/url] reach out top me.

  46. I have been looking for. The specifics here on the site is excellent and helpful and is going to help my wife and I in our studies quite a bit. It seems like everyone here acquired a significant amount of specifics regarding the things I am interested in and this page and other categories and info really show it. I’m not typically on the internet all of the time but when I drinking a beer im usually scouring for this type of knowledge and stuff closely concerning it. When anyone gets a chance, take a look at my site: snorkeling in fort lauderdale fl

  47. hi

  48. We are very happy to have discovered your web site, it is really what I have been looking for. The information here on the web page is with out a doubt needed and will help my family and friends significantly. It shows that the site gained a significant amount of info concerning the things I am interested in and the other links and info like wise show it. I’m usually not on the net all day long but when I get a break im usually looking for this sort of information and others similarly having to do with it. I have three of my friends that have picked up an interest in this because of all that I have found out about it and they will definitely to be visiting this site since it is such an awesome find. I am also facsinated in government issues and coping with the constant turns and twists in world politics. If someone gets a chance, check out at my site. [url=https://www.nickhanyokimaging.com/smithsonian-gardens-engagement-session/] Tacoma Headshot Photographer[/url]

  49. I have been looking about. This kind of knowledge on the site is excellent and needed and is going to assist my family and friends in our studies quite a bit. It shows that the site has a lot of specifics about this and this page and other categories and types of info also show it. I’m not usually browsing websites very much but when I am bored im usually hunting for this kind of knowledge and stuff closely having to do with it. If you get a chance, take a look at my website: snorkeling in miami

  50. my friends and I have been hoping for. The information on the web page is superb and helpful and is going to help My wife and her kids in our studies quite often. It looks like the site gained a large amount of details about interesting topics and other pages and information really show it. I am not on the internet during the night but when I am bored im always researching for this kind of information or others closely having to do with it. When someone gets a chance, have a look at my site. lawyers that help with social security in Santa Fe

  51. my cohorts have been searching about lately. The niche of detailed information on this web site is superb and appreciated and is going to help my friends and I in our studies twice a week or more. It shows that everyone here gained a lot of expertise concerning the stuff I am interested in and the other hyper links and types of info really show it. I’m not usually on the net most of the time but when I get an opportunity i’m more often than not researching for this sort of knowledge and things similarly concerning it. When someone gets a chance, have a look at my site: [url=https://jonsipes.com/practice-areas/drug-dependency-and-disability-benefits/]disability insurance attorney in Albuquerque New Mexico[/url]

  52. my friends from work and I have been dreaming for. The type of knowledge on this web page is truely great and appreciated and will assist my friends at work in our studies twice a week or more. It looks like this network acquired a large amount of details regarding this and other subjects and info really show it. Typically i’m not on the net during the night but when I have some time I am more often than not hunting for this sort of factual information and others closely concerning it. When you get a chance, check out at my website. elite home offer near me in South Fulton GA 30337

  53. Hello all. I am happy to have found the shares here. Ive been hunting for this info since last weekend and I will be telling my followers to hop on by. The other night I was thumbing through the web trying to uncover a solution to my staggering questions. Now I am definately to take it to the next level in whatever method I can. We are getting all pickled out on the spiritual implications we are observing. Moreover, I just hoped to thank you from the bottom of my heart for such enlightenment. This has boosted me out of a tough situation. Many vibrant things are transitioning into my world. Its really a grand community to make new connections. I need to share that I am developing. Here is my new hobby, visit my new business:[url=https://drywallpatchguys.com/]water damage company irvine ca and around DUARTE CA[/url]

  54. my friends from work and I have been hoping about. This kind of up to date info here on the website is truely great and helpful and is going to assist My wife and her kids in our studies all the time. It shows that everyone acquired a significant amount of specifics regarding the stuff I am interested in and the other hyper links and information also show it. I’m usually not on the web during the week however when I get an opportunity I am always searching for this sort of information and stuff similarly concerning it. If anyone gets a chance, have a look at my site. [url=https://squaregroupersoflo.com/][color=#000_url]snorkeling lauderdale by the sea[/color][/url]

  55. hi totally intoxicated concerning ferreting out this just as my wife and I were digging up for ways to find more information to help with our projects and new problems when I stumbled about the vastly conducive blog alas [url=https://renewablesworldwide.org/tag/solar-farm/][color=#000_url]Matthew D’Agati[/color][/url]

  56. my friends from work and I have been hoping about. The type of knowledge on the webpage is truely great and helpful and will assist my friends and I in our studies a ton. It shows that everyone here gained a significant amount of knowledge regarding subjects on the site and other subjects and information definitely show it. I am not on the net most of the time but when I get a break im more often than not searching for this type of knowledge and things closely concerning it. If anyone gets a chance, have a look at my site: academic paper editing in Providence, Rhode Island, United States city

  57. headshots has especially assumed a timely place in my marriage life. In Junior High  you’d search myself possessing a 35mm huge camera in my posession snapping headshots of my favorite friends and pets, and the mesmerizing places within the wee port locale in the Maryland bay front where my family and I went to school. The thing my cousin taught me morphed to a fine skill which I merged my life with, digesting article pictures and design photoshoots in the university.  Not long after, I initiated drafting a demanding marketing career strategy filled with beautiful momentum and life enhancing energy started to flower and show throughout my photography work. Now and for the future I continue to be a continually in demand and nominated Seattle Wedding top Photographer and service all the USA as well as all of Washington. I am also a part time Washington state Commercial Photographer. If you get a chance have a look at my website to discover more about my love: Shenandoah Wedding

  58. Hello my name is Matt D’Agati. Many executives are dazed securing a certified resume writing outfits makes a forward-thinking asset and this is a fitting quandary, so we ought to first take a look at a few of the common ends that fixed with doers that make the leap and assemble a good specialized resume creator partnership.
    Lets start this discussion by acknowledging that the site for an employment network labeled Ladders, says that sending a resume put together by a resume developing factory pertaining to any given job notice raise that woman’s opportunities of gaining employment by 70%. As proven, uploading a professionally engineered resume to virtually any online workplace vacancy listing increases that same applicant’s odds of skewering an interlocutor by 51%.

    Etch it in stone, having a diamond resume that is spruced up by a premier resume writing service delivers a needle -sharp competitive ember to administrative level job seekers and surely CEO -level employment seekers, let it be said that inevitably every for-real professional resume creator service also makes great and effective LinkedIn profiles concomitantly one of a kind resumes. Without a doubt, having finding a resume that is well -written and properly developed is certainly the most imperative way point of any job search, and having an equally grounded Facebook presence is confirmedly marginally less crucial in the way of landing a position. Matt D’Agati

  59. Wedding photography has always dedicated a quantified place in my regiment. In Junior High  someone could locate myself in hand with a thirty five mm telephoto camera in my hands taking shots of my childhood friends and plants, and the fantastic scenes conjoining the wee oceanic locale off the north Virginia ocean port where my family grew up. This thing my uncle taught me grew with time of a dedicated money making skill which I followed, scanning editorial pictures, paintings and fashion photography in my twentys.  Not long after, I instigated assimilating a busy advertising career plan filled with elegant changes and enriching energies started to manifest and shine out inside my photography jobs. This day I will always be a always exhibited and nominated Seattle Located Wedding affordable Photographer and am employed the complete United States and international destinations. I am also a top rated Seattle Commercial marketing Photographer. Also have a look at my new website in order to discover extra about my love: Richmond Family Photographer

  60. Hi fellow readers. We are really glad we came across this group. I’ve been crawling the net for this info for hours and I will be encouraging my bro to swing on by. The other evening I was skipping through the most relevant threads trying to uncover the right solution to my tough questions. Now I am going to take more responsibility in whatever avenues I can. We are getting all spaced out on the omens we are observing. Moreover, I just hoped to thank you from all of us for such excellent assistance. This has opened me out of my comfort zone. Many superb knowings are happening in my world. Its really a surprising group to make new friendships. I must make mention that I am researching. If you have time, take a look my newly created business:[url=https://staceyleephotography.net/baltimore-wedding-photographer-staceylee/][color=#000_url]portrait photography around Naples FL[/color][/url]

Leave a Reply