{"id":8149,"date":"2008-09-05T13:45:00","date_gmt":"2008-09-05T13:45:00","guid":{"rendered":"http:\/\/melotopia.net\/b\/?p=8149"},"modified":"2008-09-05T13:45:00","modified_gmt":"2008-09-05T13:45:00","slug":"%ea%b7%b8%eb%9e%98%ec%84%9c-%eb%a7%8c%eb%93%a4%ec%96%b4%eb%b3%b8-%ec%82%bc%ea%b0%81%ed%98%95-%eb%82%b4%eb%b6%80%ec%97%90-%ec%9e%88%eb%8a%94-%ec%a0%90-%ed%8c%90%ec%a0%95%ed%95%98%ea%b8%b0-%ec%86%8c","status":"publish","type":"post","link":"http:\/\/melotopia.net\/b\/?p=8149","title":{"rendered":"\uadf8\ub798\uc11c, \ub9cc\ub4e4\uc5b4\ubcf8 \uc0bc\uac01\ud615 \ub0b4\ubd80\uc5d0 \uc788\ub294 \uc810 \ud310\uc815\ud558\uae30 \uc18c\uc2a4"},"content":{"rendered":"<div class=\"desc\">\n        C\ub85c \ub9cc\ub4e4\uc5b4 \ubcf4\uc558\ub2e4. \uc544\ub294\uac8c C\ubc16\uc5d0 \uc5c6\uc73c\ub2c8&#8230;-_-;<\/p>\n<blockquote><p>\n         #define TRUE 1<br \/>\n         <br \/>\n         #define FALSE 0<\/p>\n<p>         typedef struct {<br \/>\n         <br \/>\n         double x;<br \/>\n         <br \/>\n         double y;<br \/>\n         <br \/>\n         } point;<\/p>\n<p>         typedef struct {<br \/>\n         <br \/>\n         double a;<br \/>\n         <br \/>\n         double b;<br \/>\n         <br \/>\n         double c;<br \/>\n         <br \/>\n         } line;<\/p>\n<p>         typedef struct {<br \/>\n         <br \/>\n         point t1;<br \/>\n         <br \/>\n         point t2;<br \/>\n         <br \/>\n         point t3;<br \/>\n         <br \/>\n         } triangle;<\/p>\n<p>         line lineDeclaration(point p,point q){<br \/>\n         <br \/>\n         line l;<br \/>\n         <br \/>\n         l.a=q.y-p.y;<br \/>\n         <br \/>\n         l.b=p.x-q.x;<br \/>\n         <br \/>\n         l.c=p.y*q.x-p.x*q.y;<br \/>\n         <br \/>\n         return l;<br \/>\n         <br \/>\n         }<\/p>\n<p>         double lineSubstitution(point p, line l){<br \/>\n         <br \/>\n         return l.a*p.x+l.b*p.y+l.c;<br \/>\n         <br \/>\n         }<\/p>\n<p>         double lineMultiplication(point p, point q, line l){<br \/>\n         <br \/>\n         return lineSubstitution(p, l)*lineSubstitution(q,l);<br \/>\n         <br \/>\n         }<\/p>\n<p>         point mediumPoint(point p, point q){<br \/>\n         <br \/>\n         point r={(p.x-q.x)\/2.0,(p.y-q.y)\/2.0};<br \/>\n         <br \/>\n         return r;<br \/>\n         <br \/>\n         }<\/p>\n<p>         int triangleInteriorPoints(point p, triangle t){<br \/>\n         <br \/>\n         point side[3];<br \/>\n         <br \/>\n         side[0].x=t.t1.x;<br \/>\n         <br \/>\n         side[0].y=t.t1.y;<br \/>\n         <br \/>\n         side[1].x=t.t2.x;<br \/>\n         <br \/>\n         side[1].y=t.t2.y;<br \/>\n         <br \/>\n         side[2].x=t.t3.x;<br \/>\n         <br \/>\n         side[2].y=t.t3.y;<\/p>\n<p>         int i=2;<br \/>\n         <br \/>\n         int justify=0;<br \/>\n         <br \/>\n         line l;<br \/>\n         <br \/>\n         line m;<br \/>\n         <br \/>\n         while(i){<br \/>\n         <br \/>\n         l=lineDeclaration(side[i%3],side[(i+1)%3]);<br \/>\n         <br \/>\n         m=lineDeclaration(side[(i+1)%3],side[(i+2)%3]);<br \/>\n         <br \/>\n         if(<br \/>\n         <br \/>\n         lineMultiplication(p, mediumPoint(side[(i+2)%3],side[i]), l)>0 &#038;&#038;<br \/>\n         <br \/>\n         lineMultiplication(p, mediumPoint(side[(i+2)%3],side[i]), m)>0){<br \/>\n         <br \/>\n         justify++;<br \/>\n         <br \/>\n         }<br \/>\n         <br \/>\n         i&#8211;;<br \/>\n         <br \/>\n         }<br \/>\n         <br \/>\n         if(justify==3){<br \/>\n         <br \/>\n         return TRUE;<br \/>\n         <br \/>\n         }<br \/>\n         <br \/>\n         else{<br \/>\n         <br \/>\n         return FALSE;<br \/>\n         <br \/>\n         }<br \/>\n         <br \/>\n         }<br \/>\n         \n<\/p><\/blockquote>\n<p>        \uc774\uac74 \ud5e4\ub354 \ud30c\uc77c\uc774\ub2e4. \ud14c\uc2a4\ud2b8\uc6a9 \ucf54\ub4dc\ub294 \ub2e4\uc74c\uacfc \uac19\ub2e4.<br \/>\n        <\/p>\n<blockquote><p>\n         #include<stdio.h><br \/>\n         <br \/>\n         #include<stdlib.h><br \/>\n         <br \/>\n         #include&#8221;triangle.h&#8221;<br \/>\n         <br \/>\n         #include <glib.h><br \/>\n         <br \/>\n         #include <glib\/gprintf.h><\/p>\n<p>\n         int main(int argc, char* argv[]){<br \/>\n         <br \/>\n         if(argc==1){<br \/>\n         <br \/>\n         printf(&#8220;ERROR. There are no inputs.\\n Usage : %s file1 file2\\n file1 includes triangle data\\n file2 includes points data\\n&#8221;, argv[0]);<br \/>\n         <br \/>\n         exit(1);<br \/>\n         <br \/>\n         }<br \/>\n         <br \/>\n         FILE *TRIDATA;<br \/>\n         <br \/>\n         FILE *POINTDATA;<br \/>\n         <br \/>\n         if(!(TRIDATA=fopen(argv[1], &#8220;rt&#8221;))){<br \/>\n         <br \/>\n         printf(&#8220;ERROR. %s does not exists.\\n&#8221;,argv[1]);<br \/>\n         <br \/>\n         exit(1);<br \/>\n         <br \/>\n         }<br \/>\n         <br \/>\n         if(!(POINTDATA=fopen(argv[2],&#8221;rt&#8221;))){<br \/>\n         <br \/>\n         printf(&#8220;ERROR. %s does not exists.\\n&#8221;,argv[2]);<br \/>\n         <br \/>\n         exit(1);<br \/>\n         <br \/>\n         }<\/p>\n<p>         char buf1[200];<br \/>\n         <br \/>\n         char **buffer1;<br \/>\n         <br \/>\n         char buf2[200];<br \/>\n         <br \/>\n         char **buffer2;<\/p>\n<p>         int i=0;<\/p>\n<p>         while(!feof(TRIDATA) &#038;&#038; !feof(POINTDATA)){<br \/>\n         <br \/>\n         fgets(buf1,200, TRIDATA);<br \/>\n         <br \/>\n         fgets(buf2,200,POINTDATA);<br \/>\n         <br \/>\n         buffer1=g_strsplit(buf1, &#8220;,&#8221;, 6);<\/p>\n<p>         triangle tri;<br \/>\n         <br \/>\n         tri.t1.x=atof(buffer1[0]);<br \/>\n         <br \/>\n         tri.t1.y=atof(buffer1[1]);<br \/>\n         <br \/>\n         tri.t2.x=atof(buffer1[2]);<br \/>\n         <br \/>\n         tri.t2.y=atof(buffer1[3]);<br \/>\n         <br \/>\n         tri.t3.x=atof(buffer1[4]);<br \/>\n         <br \/>\n         tri.t3.y=atof(buffer1[5]);<\/p>\n<p>         buffer2=g_strsplit(buf2, &#8220;,&#8221;,2);<br \/>\n         <br \/>\n         point po;<br \/>\n         <br \/>\n         po.x=atof(buffer2[0]);<br \/>\n         <br \/>\n         po.y=atof(buffer2[1]);<\/p>\n<p>         printf(&#8220;%d,%d\\n&#8221;,triangleInteriorPoints(po, tri),i++);<br \/>\n         <br \/>\n         g_strfreev(buffer1);<br \/>\n         <br \/>\n         g_strfreev(buffer2);<\/p>\n<p>         }<br \/>\n         <br \/>\n         return 1;<br \/>\n         <br \/>\n         }\n        <\/p><\/blockquote>\n<p>        \uadf8\ub9ac\uace0 \ucef4\ud30c\uc77c \uba85\ub839\uc5b4\ub294 \ub2e4\uc74c\uacfc \uac19\ub2e4.<br \/>\n        <\/p>\n<blockquote><p>\n         gcc `pkg-config &#8211;cflags &#8211;libs glib-2.0` -o triangle triangle.c\n        <\/p><\/blockquote>\n<p>        glib2\uac00 \uc788\uc5b4\uc57c \ucef4\ud30c\uc77c \ub41c\ub2e4\ub294 \uc810\uc5d0 \uc8fc\uc758\ud558\uc5ec\uc57c \ud55c\ub2e4.<br \/>\n        <br \/>\n        \uc0ac\uc6a9\ubc95\uc740 \ub2e4\uc74c\uacfc \uac19\ub2e4.<br \/>\n        <\/p>\n<blockquote><p>\n         Usage : .\/triangle file1 file2<br \/>\n         <br \/>\n         file1 includes triangle data<br \/>\n         <br \/>\n         file2 includes points data\n        <\/p><\/blockquote>\n<p>        triangle data\ub294 \ucf64\ub9c8(,)\ub85c \uad6c\ubd84\ub41c 6\uac1c\uc758 \uc2e4\uc218\uac00 \ub4e4\uc5b4\uac00\uace0, points data\ub294 \ucf64\ub9c8\ub85c \uad6c\ubd84\ub41c 2\uac1c\uc758 \uc2e4\uc218\uac00 \ub4e4\uc5b4\uac04\ub2e4.<\/p>\n<p><\/p>\n<div style=\"width:100%;margin-top:30px;clear:both;height:30px\">\n<div style=\"width:31px;float:left;\">\n<a href=\"\/toolbar\/popup\/abuseReport\/?entryId=952\" onclick=\"window.open(this.href, 'tistoryThisBlogPopup', 'width=550, height=510, toolbar=no, menubar=no, status=no, scrollbars=no'); return false;\"><br \/>\n<img data-recalc-dims=\"1\" decoding=\"async\" alt=\"\uc2e0\uace0\" src=\"https:\/\/i0.wp.com\/t1.daumcdn.net\/tistory_admin\/static\/ico\/ico_spam_report.png\" style=\"border:0\"\/><br \/>\n<\/a>\n<\/div>\n<\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>C\ub85c \ub9cc\ub4e4\uc5b4 \ubcf4\uc558\ub2e4. \uc544\ub294\uac8c C\ubc16\uc5d0 \uc5c6\uc73c\ub2c8&#8230;-_-; #define TRUE 1 #define FALSE 0 typedef struct { double x; double y; } point; typedef struct { double a; double b; double c; } line; typedef struct { point t1; point t2; point t3; } triangle; line lineDeclaration(point p,point q){ line l; l.a=q.y-p.y; l.b=p.x-q.x; l.c=p.y*q.x-p.x*q.y; return l; } [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_crdt_document":"","_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[12],"tags":[],"class_list":["post-8149","post","type-post","status-publish","format-standard","hentry","category-12"],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p8o6gA-27r","jetpack-related-posts":[],"jetpack_likes_enabled":true,"_links":{"self":[{"href":"http:\/\/melotopia.net\/b\/index.php?rest_route=\/wp\/v2\/posts\/8149","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/melotopia.net\/b\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/melotopia.net\/b\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/melotopia.net\/b\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/melotopia.net\/b\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=8149"}],"version-history":[{"count":0,"href":"http:\/\/melotopia.net\/b\/index.php?rest_route=\/wp\/v2\/posts\/8149\/revisions"}],"wp:attachment":[{"href":"http:\/\/melotopia.net\/b\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=8149"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/melotopia.net\/b\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=8149"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/melotopia.net\/b\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=8149"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}