Horoscope App

ホロスコープとは:

西洋占星術で生まれたときの星の位置を12星座の図に表したもの。

製品について

図形を描画するprcessingという言語で作成しました。
学校の授業で素人が制作したものであり、実用的とはいいがたいので注意してください。

使い方

難しかったところ

        
            //ホロスコープを実際に表示させるための関数

            void showHoroscope(float theta[], float r, color array[]) {
            //PImage img[] = {iconp1, iconp2,  iconp3,  iconp4,  iconp5,  iconp6,  iconp7,  iconp8,  iconp9,  iconp10};

            pushMatrix();
            translate(width/2, height*3/7); //中心座標に据える
            for (int i=0; i< theta.length-1; i++) {
                for (int diff=1; diff< theta.length - i; diff++) {
                    float x = (cos(radians(theta[i])))* 21*r/26;
                    float y = (sin(radians(theta[i])))* 21*r/26;
                    float remainder; //差分
                    float orb = Orb;
                    
                    //角度の差を図る
                    if (theta[i] >= theta[i+diff]) {
                        remainder = theta[i] - theta[i+diff];
                    } else {
                        remainder = theta[i] - theta[i+diff];
                    }


                    float X = (cos(radians(theta[i+diff])))* 21*r/26;
                    float Y = (sin(radians(theta[i+diff])))* 21*r/26;

                    strokeWeight(5);

                    if ( 60 -orb < remainder && remainder < 60 + orb) {  //60度
                        stroke(#00FFFF); //aqua
                        line(x, y, X, Y);
                    }

                    if ( 90-orb < remainder && remainder < 90+orb) { //90度
                        stroke(#DC143C);//crimson
                        line(x, y, X, Y);
                    }

                    if ( 120-orb < remainder && remainder < 120+orb) { //120度
                        stroke(#00CED1);//darkターコイズ
                        line(x, y, X, Y);
                    }

                    if ( 135-orb < remainder && remainder < 135+orb) { //135度
                        stroke(#F5FFFA); //ミントクリーム
                        line(x, y, X, Y);
                    }

                    if ( 150 - orb < remainder && remainder < 150 + orb) { //150度
                        stroke(#66CDAA); //ミディアムアクアマリン
                        line(x, y, X, Y);
                    }

                    if ( 180 -orb < remainder && remainder < 180+orb) {  //180度
                        stroke(#F08080); //lightDoral
                        line(x, y, X, Y);
                    }

                    float pr=20;
                    float intensity = 100; //惑星の色の濃さ
                    if ( i==1 ) { //太陽
                        pr =100;
                        intensity = 30;
                    } else if ( i==2 ) { //月
                        pr = 15;
                        intensity = 30;
                    } else if ( i==3 ) { //水星
                        pr = 20;
                        intensity = 60;
                    } else if ( i==4) { //金星
                        pr = 30;
                        intensity = 70;
                    } else if ( i==5 ) { //火星
                        pr = 30;
                        intensity = 60;
                    } else if ( i==6 ) { //木星
                        pr = 40;
                        intensity = 80;
                    } else if ( i==7 ) { //土星
                        pr = 40;
                        intensity = 90;
                    } else if ( i==8 ) { //天王星
                        pr = 35;
                        intensity = 80;
                    } else if ( i==9 ) { //海王星
                        pr = 35;
                        intensity = 80;
                    }

                    if ( i != 1 && i != 2) {
                        strokeWeight(2);
                        stroke(array[i]);
                        //icon[i] = new Icon ( x, y, array[i],img[i], pr);
                        fill(array[i], intensity);
                        circle(x, y, pr);
                    
                    } else if (i==1) { //太陽だけひまわり
                        strokeWeight(2);
                        stroke(255);
                        //icon[i] = new Icon ( x, y, array[i],img[i], pr);
                        fill(array[i], intensity);
                        sun_flower = new Flower(x,y,pr,5,4);
                        sun_flower.flower();
                    } else if (i==2){
                        strokeWeight(0.2);
                        stroke(255);
                        //icon[i] = new Icon ( x, y, array[i],img[i], pr);
                        fill(array[i], intensity);
                        moon_flower = new Flower(x,y,pr,5,2);
                        moon_flower.flower();
                    }
                }
            }

            //冥王星を表示/角度はtheta[i+1]で一緒に計算されている
            float x = (cos(radians(theta[10])))* 21*r/26;
            float y = (sin(radians(theta[10])))* 21*r/26;
            //icon[9] = new Icon ( x, y, array[10],img[9], 100);
            stroke(array[10]);
            fill(array[10], 80);
            circle(x, y, 35);

            popMatrix();

            strokeWeight(1);
        }