Функ­ция — ко­но­пля

На Ха­б­ре по­яви­лась те­ма, упо­ми­наю­щая мою дав­нюю ра­бо­ту — функ­цию, гра­фик ко­то­рой на­по­ми­на­ет лист ко­но­пли. К со­жа­ле­нию, в свя­зи с не­от­вра­ти­мым на­ступ­ле­ни­ем но­во­го го­да я сей­час не мо­гу уде­лить этой про­бле­ме до­ста­точ­но вни­ма­ния, по­это­му про­сто пуб­ли­кую не­ко­то­рые ма­те­ри­а­лы:

1. Про­грам­ма, ри­сую­щая гра­фик функ­ции: Cannabola.exe (284 Кбайта, ска­чан 572 раза);

2. Изоб­ра­же­ние (на­жми­те, что­бы за­гру­зить кар­тин­ку 8192×8192 пик­се­ля):

Гра­фик функ­ции, на­по­ми­наю­щий лист ко­но­пли
Гра­фик функ­ции, на­по­ми­наю­щий лист ко­но­пли

3. Ис­ход­ный код функ­ции (Pascal/Delphi; по­ка не имею воз­мож­но­сти вы­ло­жить текст всей про­грам­мы):

Function CannabolaValue(A,R: Double): Double;
Begin //Функция — конопля (в полярных координатах)
    result:=((1/(abs(cos(A/2*7-R*R*R*R*0.3))+0.005/R)+ //Листики
            8*sqr(sin(A/2*7))/(sqr(R/abs(sin(A/2)))*10+1)/
            (abs(sin(  (R-(arccos(cos((A+pi)*7-R*R*R*R*0.3))+
                2*R*sqr(arccos(cos((A+pi)*7-R*R*R*R*0.3)))) /20)*8*pi  ))+0.1+
                sqr(cos(A/2*7-R*R*R*R*0.3)))+ //Зарубки и прожилки
            3/(sqr(100*R)+0.1))* //Точка сосединения листиков
            (abs(sin(A/2))-R*R)- //Длина листиков
            abs(sin(A/2)))* //Толщина листиков
            (1+ 0.01/(sqr(sin(R*cos(A)*100+10*cos(R*sin(A)*40))+
                sin(R*sin(A)*100+10*sin(R*cos(A)*40)))+0.01) )+ //Сосудики
            (R+0.2)*0.0002/(sqr(A-R*0.1)+0.0001); //Ножка
End;

P.S. На­по­ми­наю, что ав­тор­ское пра­во на на­зва­ние «Кан­на­бо­ла» при­над­ле­жит Supman'у.

102 отзыва на запись «Функ­ция — ко­но­пля»

Ко­гда в ин­тер­не­те не на­шел про­грам­му из ар­буз­но­го то­пи­ка, при­нял­ся пи­сать свою. Как ока­за­лось, зря http://code.google.com/p/powder96-stuff/downloads/detail?name=cannabola.zip
Ах да, за­был про мно­го­чис­лен­ные во­про­сы, ко­то­рые у ме­ня воз­ни­ки­ли.
1) Как Вы раз­ру­ли­ва­ли си­ту­а­цию с де­ле­ни­ем на ноль (на­при­мер, в f1)? Я де­лал так, но ИМХО это вы­гля­дит как ко­стыль. // prevent division by 0
if(angle == 0)
angle = 0.000000001;
if(radius == 0)
radius = 0.000000001;

2) Как Вы рас­счи­ты­ва­ли цвет точ­ки на ос­но­ва­нии зна­че­ния ф-ции?
3) Как по­лу­чи­лось сгла­жи­ва­ние? По-идее, ес­ли Вы про­хо­ди­тесь цик­лом по x,y (что­бы не бы­ло «лу­чей»), то у каж­дой точ­ки бу­дет кон­крет­ный цвет – «раз­ма­зы­ва­ния», как со сгла­жен­ны­ми ли­ни­я­ми (см. ал­го­ритм Ву) быть не долж­но.
1) Си­ту­а­ция с де­ле­ни­ем на 0 у ме­ня не воз­ни­ка­ла: оси X и Y про­хо­дят в точ­но­сти по цен­тру изоб­ра­же­ния, а изоб­ра­же­ние со­дер­жит чёт­ное чис­ло пик­се­лей, по­это­му точ­ка (0,0) на­хо­дит­ся по­се­ре­ди­не меж­ду пик­се­ля­ми и ни­ко­гда не вы­чис­ля­ет­ся. 2) Кон­крет­ной фор­му­лы для цве­та у менч сей­час с со­бой нет, но, ка­жет­ся, там бы­ло так: бе­лый цвет для от­ри­ца­тель­ных зна­че­ний функ­ции, а даль­ше ли­ней­ная функ­ция от тём­но-зе­лё­но­го до свет­ло-зе­лё­но­го. 3) Сгла­жи­ва­ние (ан­тиа­ли­а­синг) де­ла­лось при по­мо­щи овер­сем­плин­га: каж­дый пик­сел бил­ся на 3×3 оди­на­ко­вых под­пик­се­ля, в них вы­чис­лял­ся цвет, ко­то­рый усред­нял­ся. Для боль­шей глад­ко­сти ли­ний при­ме­не­на про­стей­шая гам­ма-кор­рек­ция при усред­не­нии — воз­ве­де­ние в квад­рат и квад­рат­ный ко­рень по­сле усред­не­ния (смот­ри­те цве­то­вое про­стран­ство sRGB для бо­лее по­дроб­ной ин­фор­ма­ции).
1) По­нят­но. Про­бле­ма про­сто не про­яви­лась. ОК, то­гда бу­ду счи­тать свой об­ход­ной путь пра­виль­ным 2) Это бы­ло опи­са­но еще на ар­бу­зе: «Внут­рен­ность ли­ста ко­но­пли оп­ре­де­ля­ет­ся урав­не­ни­ем F(A,R)>0». Но там не бы­ло ска­за­но про то, как ис­поль­зуя зна­че­ние функ­ции, по­лу­чить RGB. 3) По­лу­ча­ет­ся, что из-за сгла­жи­ва­ния, про­грам­ма бу­дет ра­бо­тать, очень гру­бо го­во­ря, в 9 раз доль­ше…
Да, всё так.
У ме­ня ни­че­го не по­лу­ча­ет­ся
procedure TForm1.FormPaint(Sender: TObject);
var
  x,y,_x,_y: integer;
  a,r,color: double;
begin
  asm
  finit //обходим divizion by zero
  end;
  for y:=0 to Form1.ClientHeight-1 do
    for x:=0 to Form1.ClientWidth-1 do
    begin
      _x:=x-Form1.ClientWidth div 2;
      _y:=y-Form1.ClientHeight div 2;
      a:=arctan(_y/_x);
      if _x=0 then
          a:=a+PI
        else
          a:=a-PI;
      r:=sqrt(_x*_x+_y*_y);
      color:=CannabolaValue(a,r);
      if color<0 then
        Form1.Canvas.Pixels[x,y]:=round(color*255);
    end;
end;
Ри­со­вать на­до по­ло­жи­тель­ные цве­та
Зна­че­ние функ­ции CannabolaValue от­ри­ца­тель­но во всех точ­ках.
То­гда дру­гое пред­по­ло­же­ние: «лист» впи­сан в круг еди­нич­но­го ра­ди­у­са. У вас же еди­нич­ный ра­ди­ус со­от­вет­ству­ет од­но­му пик­се­лю. Зна­чит, ва­ша про­грам­ма ри­су­ет лист ко­но­пли раз­ме­ром в один пик­сель.
Сде­лал так
color:=CannabolaValue(a,r/200); По­яви­лись зна­ко­мые очер­та­ния
http://imageshost.ru/photo/27800/id1440916.html Но всё рав­но не то.
Вы не­вер­но пе­ре­во­ди­те _x, _y в угол. Кро­ме то­го, нель­зя про­сто так при­сваи­вать зна­че­нию Pixels[x,y] це­лое чис­ло. Во-пер­вых, Pixels[x,y] со­сто­ит из че­ты­рёх байт (по бай­ту на ка­нал и один не­ис­поль­зуе­мый), нуж­но сфор­ми­ро­вать цвет из трёх ком­по­нен­тов и упа­ко­вать его в integer. Во вто­рых, color по зна­че­нию мо­жет пре­вы­сить еди­ни­цу, и, зна­чит, при­сваи­ва­е­мое зна­че­ние мо­жет пре­вы­сить 255.
Ка­жет­ся на­шёл глюк
У ме­ня не со­хра­нил­ся ис­ход­ник и я ко­пи­ро­вал свой код с это­го сай­та if _x=0 then
a:=a+PI
else Из­на­чаль­но бы­ло не так Вы­чис­лял­ся угол в диа­па­зо­не от -PI до PI.
Ви­ди­мо, это тег <code> по­ел зна­ки мень­ше-боль­ше. На­до ис­поль­зо­вать <pre>. Ду­рац­кий WordPress.
В об­щем разо­брал­ся. Ес­ли вы­чис­лять угол так всё отоб­ра­жа­ет­ся нор­маль­но a:=arctan2(_y,_x)-PI/2;
if _x and _y<0 then
a:=a+PI*2; Спа­си­бо.
Avec un foyer identifie a Baie-Mahault toujours actif. Les gens ont le droit de savoir. http://lenitsky.com/ Du fait de l insolvabilite des prevenus – M. Plusieurs facteurs potentiels sont avances. Tout est mesurable.
Le patient reste muet. Mais pour moi, pour le moment, tout va bien. Andrey Lenitsky Et a ce titre elle ne peut pas etre banalisee … . Le pere d une copine l a transportee a l hopital. Mon metier, c est de m occuper des autres.
Puis aux deux tiers les trente jours suivants. J ai laisse trainer. Andrey Lenitsky Alexandre fut un expert. Vincent Lambert est victime d’un accident de la route. Elle ne la connait meme pas.
Ес­ли ми­мо про­ез­жа­ли лег­ко­вуш­ка или гру­зо­вик, Хе­лен с Джу­ли­ей оста­нав­ли­ва­лись и, чувств https://inava.ru/kak-vyibrat-tsvet-svadebnogo-platya/ За­по­ро­шен­ная из­вест­ко­вой пы­лью, она по по­яс ушла в гру­ду би­тых кир­пи­чей и де­ре­вя­шек, а
Пря­мо над го­ло­вой с по­тол­ка сви­сал огром­ный вен­ти­ля­тор, его ги­гант­ские ло­па­сти мо­но­тон https://inava.ru/monastryirskiy-chay-dlya-lecheniya-prostatita/ Яв­но же­лая от­де­лить се­бя от стран­ных увле­че­ний Херцо­га, Джек Адамс про­дол­жил: — Дол­жен
Buy Fluoxetine
Eat a generic wiki for for for good.
buy phenergan
purchase flagyl
Buy Fluoxetine
revia
Hello, always i used to check blog posts here in the early hours in the daylight,
Thanks for sharing your thoughts about minecraft.
Regards
Everything is very open with a really clear clarification of the challenges.
It was definitely informative. Your site is very helpful.
Many thanks for sharing!
Wow that was strange. I just wrote an incredibly long
comment but after I clicked submit my comment didn’t appear.
Grrrr… well I’m not writing all that over again. Anyways, just wanted to say wonderful blog!
I am regular visitor, how are you everybody?
This article posted at this site is really pleasant.
Hello, i think that i saw you visited my site so i got here to go back the desire?.I am attempting to find issues to improve my site!I suppose its good
enough to use some of your concepts!!
Wow that was unusual. I just wrote an really
long comment but after I clicked submit my comment didn’t appear.
Grrrr… well I’m not writing all that over again. Anyways, just wanted to say superb blog!
It’s really a great and useful piece of info. I’m glad that you simply shared this helpful info with us.
Please keep us informed like this. Thank you for sharing.
Hi! Would you mind if I share your blog with my facebook group?
There’s a lot of folks that I think would really enjoy your content.
Please let me know. Thank you
You’re so awesome! I don’t believe I have read a single thing like this before.
So great to discover someone with some original thoughts on this issue. Really.. many thanks for starting this up. This web site is something that is
required on the internet, someone with a bit of originality!
Hola! I’ve been reading your website for a long time now and finally got the courage to go ahead
and give you a shout out from Atascocita Texas!
Just wanted to tell you keep up the excellent work!
What’s up, the whole thing is going well here and
ofcourse every one is sharing data, that’s really excellent,
keep up writing.
Actually when someone doesn’t be aware of afterward its up to other visitors
that they will help, so here it takes place.
Hi, this weekend is good in favor of me, for the
reason that this moment i am reading this fantastic informative paragraph here at my
residence.
We stumbled over here different page and thought I might check things out.
I like what I see so now i’m following you.
Look forward to checking out your web page yet again.
Hey there! Do you know if they make any plugins to help with Search Engine Optimization? I’m trying to
get my blog to rank for some targeted keywords but I’m not seeing very good gains.
If you know of any please share. Many thanks!
Hi, i feel that i noticed you visited my site so i got here to return the
choose?.I’m attempting to find issues to enhance my website!I assume its good enough to make use of a few of your ideas!!
Fantastic beat ! I wish to apprentice whilst
you amend your site, how can i subscribe for a weblog website?
The account aided me a applicable deal. I have been tiny bit acquainted
of this your broadcast offered vibrant transparent idea
I’m really enjoying the design and layout of your blog.
It’s a very easy on the eyes which makes it much more enjoyable for me to
come here and visit more often. Did you hire out a designer to create your
theme? Fantastic work!
I like the helpful info you provide to your articles. I’ll bookmark your blog and check once more here regularly. I’m quite sure I’ll be told many new stuff right right here!
Best of luck for the next!
I used to be able to find good information from your content.
Thank you for the auspicious writeup. It if truth be told was a entertainment
account it. Look complex to far introduced agreeable from you!
However, how could we communicate?
Thanks , I’ve just been searching for info about this
topic for a long time and yours is the greatest I’ve found out
so far. However, what in regards to the conclusion? Are you positive
concerning the source?
Aw, this was an incredibly good post. Taking a few minutes and actual effort to produce
a really good article… but what can I say… I procrastinate a whole lot and never manage to get anything done.
It’s very trouble-free to find out any topic on net as compared to textbooks,
as I found this post at this web site.
You made some really good points there. I looked on the internet for more info about the issue and found most people will go along with your views on this website.
It’s truly very complicated in this busy life to listen news on Television, therefore I simply use internet for that purpose, and obtain the latest information.
Hi there, this weekend is fastidious designed for me, since this
point in time i am reading this enormous educational piece of writing here at my home.
Every weekend i used to go to see this website, as i wish for enjoyment, for the reason that this this site conations actually good funny stuff too.
I was suggested this web site by my cousin. I am no longer positive whether or not this
submit is written by way of him as nobody else know such specified about my problem. You’re incredible! Thank you!
Thanks for the auspicious writeup. It in reality was a leisure account it. Glance complicated to far added agreeable from you!
By the way, how could we keep up a correspondence? Here is my web-site … best cs go skin betting
Usually I do not read post on blogs, however I would like
to say that this write-up very pressured me to check out and do
so! Your writing taste has been surprised me. Thanks, quite nice post. Also visit my weblog … madden mobile coins for sale ebay
What’s up, I desire to subscribe for this webpage to obtain newest updates, therefore where
can i do it please help out. my page :: mink lashes kit wholesale (http://www.sabt-es.ir/Default.aspx?tabid=56&userId=84882)
Hi, i think that i saw you visited my website thus i came to
“return the favor”.I’m attempting to find things to
enhance my website!I suppose its ok to use some of your ideas!!
Thanks for ones marvelous posting! I certainly enjoyed reading
it, you will be a great author. I will make sure to bookmark your blog and will often come back later in life. I want to encourage yourself to continue your great posts,
have a nice evening!
Actually no matter if someone doesn’t be aware of then its up to other visitors that they will help,
so here it happens. My website :: madden 17 coins buy
It’s remarkable to pay a quick visit this web page and reading the views of all mates on the topic of this article, while I am also eager of
getting familiarity. Here is my web-site … cs go knife skins steam
I was recommended this blog by my cousin. I am not sure whether
this post is written by him as no one else know such detailed about my
trouble. You’re amazing! Thanks! Here is my web blog — minkys lash extensions training
Hey there great website! Does running a blog like
this require a great deal of work? I’ve absolutely no expertise in computer
programming however I was hoping to start my own blog soon. Anyways, should you
have any recommendations or techniques for new blog owners
please share. I understand this is off subject however I just needed to ask. Thanks! Also visit my web blog: nba mobile coins reddit
Hi there are using WordPress for your site platform?
I’m new to the blog world but I’m trying to get started and create my own. Do you need any
coding knowledge to make your own blog? Any help would be really appreciated! Here is my blog post — cs go knife skins steam
Hi there, You have done a great job. I will
certainly digg it and personally suggest to my friends.
I’m confident they will be benefited from this website. Here is my web-site mink lash extensions london
Its not my first time to pay a visit this web site, i am visiting this web site dailly and obtain good
facts from here daily. Also visit my homepage :: sell cs go skins for cash
Hey! I just wanted to ask if you ever have any issues with
hackers? My last blog (wordpress) was hacked and I ended up losing months of hard work due to no backup.
Do you have any methods to prevent hackers? Also visit my webpage — mink eyelash extensions kitchener
Wow that was odd. I just wrote an very long comment but after I clicked submit my comment didn’t appear. Grrrr… well I’m not writing all that over again. Regardless,
just wanted to say superb blog! Feel free to surf to my site: cs go skins cash out, rfserver.net,
Hi to every one, it’s truly a pleasant for me to go to see this web page, it includes useful Information. my weblog fifa 17 coins generator no survey
If you desire to take a good deal from this article then you have
to apply such methods to your won blog. Feel free to surf to my weblog :: madden mobile
coins buy cheap [http://exchange-metal.com/]
Its like you learn my thoughts! You appear to understand a lot about this, like you wrote the e book in it or
something. I feel that you simply could do with a few percent to power the message house a little bit, however instead of that,
this is magnificent blog. A fantastic read. I will definitely be back. My web site: nba live coins and cash
Fantastic site you have here but I was curious if you knew of any message boards that cover the same topics discussed in this article?
I’d really love to be a part of group where I can get responses from
other knowledgeable individuals that share the same interest.
If you have any recommendations, please let me know.
Appreciate it! My webpage; 1 (Modesto)
Hi there, all is going sound here and ofcourse every one
is sharing facts, that’s genuinely excellent, keep up writing. Here is my website — 1 (Helaine)
constantly i used to read smaller posts that also
clear their motive, and that is also happening with this piece of writing which I
am reading at this place. Also visit my blog post: fps games; http://www.hbmgmt.com,
You should be a part of a contest for one of the highest quality
blogs online. I will recommend this web site! my web-site; cs go skin betting websites; ryanthomas645.co.uk,
Having read this I believed it was very informative. I
appreciate you finding the time and energy to put this content together.
I once again find myself spending way too much time both reading and leaving
comments. But so what, it was still worthwhile! Here is my web site :: mink individual lashes kit (Nelson)
Hello There. I found your weblog using msn. This is an extremely neatly written article.
I will make sure to bookmark it and come back to learn extra of your useful information. Thanks for the post.
I will certainly return. Feel free to surf to my homepage — silk lash extensions wholesale
You need to take part in a contest for one of the finest websites on the web. I most certainly will highly recommend this blog! Here is my webpage; csgo skins free download
It is the best time to make some plans for the future and it’s
time to be happy. I have read this post and if I could I
want to suggest you some interesting things or suggestions.
Maybe you can write next articles referring to this article.
I desire to read more things about it! Feel free to surf to my page; best madden players
(Juana)
We’re a group of volunteers and opening a new scheme in our community.
Your web site offered us with valuable information to
work on. You have done an impressive job and our whole community will be
thankful to you. My page; mink lashes bad kitty
Ahaa, its pleasant conversation on the topic of this piece of writing
at this place at this webpage, I have read all that,
so at this time me also commenting at this place.
I read this article completely regarding the difference of most recent and earlier
technologies, it’s awesome article. My homepage :: mink lashes sephora
Hey! I know this is kinda off topic however I’d figured I’d
ask. Would you be interested in trading links
or maybe guest writing a blog post or vice-versa?
My site covers a lot of the same topics as yours and I believe we could greatly benefit
from each other. If you are interested feel free to send me an email.
I look forward to hearing from you! Fantastic blog by the way! Feel free to visit my homepage; fifa 17 coins xbox one uk (Mercedes)
It’s very easy to find out any matter on net as compared to books,
as I found this piece of writing at this web site. Also visit my web-site csgo skins free download
Good day very cool web site!! Guy .. Excellent .. Superb
.. I’ll bookmark your website and take the feeds additionally?
I’m satisfied to seek out a lot of useful info here within the post,
we need develop more strategies in this regard, thank you for
sharing. . . . . . Also visit my blog post mink lash extensions dublin (Cara)
Hi there! I realize this is kind of off-topic however I had to ask.
Does managing a well-established blog like yours take a large amount of work?
I am brand new to operating a blog but I do write in my
journal daily. I’d like to start a blog so I will be able to share my
own experience and views online. Please let me know if you have any
ideas or tips for new aspiring bloggers. Thankyou! Have a look at my homepage: csgo skins free hack
Have you ever thought about including a little bit more than just your articles?
I mean, what you say is important and everything. But think of if you added some great images or video clips to give your posts more,
«pop»! Your content is excellent but with images and clips, this blog could definitely be one of the greatest in its
field. Good blog! Feel free to visit my website — madden mobile free coins no survey or download
Great blog you have got here.. It’s hard to find excellent writing like yours these days.
I honestly appreciate people like you! Take care!! My blog post — buy cheap nba live coins
Do you have a spam problem on this blog; I also am a blogger, and I was curious about your situation; we have
developed some nice methods and we are looking to trade methods with
other folks, please shoot me an email if interested. Also visit my website :: madden mobile coin dealer
Please let me know if you’re looking for a article writer
for your site. You have some really great articles and I feel I would be a
good asset. If you ever want to take some of the load off,
I’d love to write some content for your blog in exchange
for a link back to mine. Please blast me an e-mail
if interested. Thank you! My web site — csgo skins for cash instantly (Felix)
Howdy would you mind letting me know which webhost you’re working with?
I’ve loaded your blog in 3 different internet browsers and I must
say this blog loads a lot faster then most. Can you suggest a good hosting provider at a fair
price? Cheers, I appreciate it! Stop by my web page … mink eyelash extensions near me (Ron)
Today, while I was at work, my cousin stole my iPad and
tested to see if it can survive a 25 foot drop, just so she can be a youtube sensation. My
apple ipad is now destroyed and she has 83 views. I know this is totally off topic but I had to share it with someone! Here is my blog post … csgo skins price drop — Terese -
I really love your site.. Pleasant colors & theme. Did you develop this amazing site yourself?
Please reply back as I’m wanting to create my own website and
would love to know where you got this from or exactly what the
theme is called. Many thanks! Feel free to surf to my weblog … mink lashes extensions near me (lonoco.net)
For most up-to-date information you have to pay a quick
visit web and on web I found this site as a most excellent web page for most up-to-date updates. my blog post … nba live coins and cash (Victor)
I all the time used to study paragraph in news papers but now as I am a user of net so from now I am using net for articles, thanks
to web. Here is my weblog: fifa coins buy review (Danelle)
I was suggested this blog by means of my cousin. I am now not sure
whether this put up is written via him as nobody else know such certain approximately my trouble.
You are incredible! Thanks!
Amazing! Its really amazing post, I have got much clear
idea on the topic of from this article. Check out my webpage — csgo skins price drop (http://www.micheleweb.it/)
For most recent news you have to visit internet and on web I
found this site as a most excellent website for hottest updates. Here is my site; madden mobile coin generator no survey
no download (Shayla)
wonderful issues altogether, you just won a brand new reader.
What may you recommend in regards to your post that you simply made some days ago? Any certain? Feel free to surf to my web site fifa coins ps4 ebay (Rubin)
I’ve been surfing online more than three hours today, yet I never found any interesting article
like yours. It is pretty worth enough for me. Personally, if
all site owners and bloggers made good content as you did,
the net will be much more useful than ever before. Also visit my site … mink lashes for sale (Chanda)
Great article! We are linking to this great article on our site.
Keep up the good writing. Look into my page :: siberian mink lashes for sale; Johnny,

Оставить отзыв

Жёлтые поля обязательны к заполнению

   

Можете использовать теги <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang=""> <div class=""> <span class=""> <br>