亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? conrec.java

?? java 等值線 生成算法
?? JAVA
字號:
package util;

/*
 * Conrec.java
 *
 * Created on 5 August 2001, 15:03
 *
 * Copyright (c) 1996-1997 Nicholas Yue
 *
 * This software is copyrighted by Nicholas Yue. This code is base on the work of
 * Paul D. Bourke CONREC.F routine
 *
 * The authors hereby grant permission to use, copy, and distribute this
 * software and its documentation for any purpose, provided that existing
 * copyright notices are retained in all copies and that this notice is included
 * verbatim in any distributions. Additionally, the authors grant permission to
 * modify this software and its documentation for any purpose, provided that
 * such modifications are not distributed without the explicit consent of the
 * authors and that existing copyright notices are retained in all copies. Some
 * of the algorithms implemented by this software are patented, observe all
 * applicable patent law.
 *
 * IN NO EVENT SHALL THE AUTHORS OR DISTRIBUTORS BE LIABLE TO ANY PARTY FOR
 * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
 * OF THE USE OF THIS SOFTWARE, ITS DOCUMENTATION, OR ANY DERIVATIVES THEREOF,
 * EVEN IF THE AUTHORS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 *
 * THE AUTHORS AND DISTRIBUTORS SPECIFICALLY DISCLAIM ANY WARRANTIES, INCLUDING,
 * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
 * PARTICULAR PURPOSE, AND NON-INFRINGEMENT.  THIS SOFTWARE IS PROVIDED ON AN
 * "AS IS" BASIS, AND THE AUTHORS AND DISTRIBUTORS HAVE NO OBLIGATION TO PROVIDE
 * MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
 */
 


/**
 * Conrec a straightforward method of contouring some surface represented a regular 
 * triangular mesh. 
 *
 * Ported from the C++ code by Nicholas Yue (see above copyright notice).
 * @see http://astronomy.swin.edu.au/pbourke/projection/conrec/ for full description
 * of code and original C++ source.
 *
 * @author  Bradley White
 * @version 1.0 
 */
public class Conrec {

    private double  []  h   =  new double [5];
    private int     []  sh  =  new int    [5];
    private double  []  xh  =  new double [5];
    private double  []  yh  =  new double [5];
    
    // Object that knows how to draw the contour
    private Render render = null;
 
    /** Creates new Conrec */
    public  Conrec(Render render) throws Exception {
        if (render == null){
            throw new Exception ("Render null");
        }
        this.render = render;
    }
    

    /**
     *     contour is a contouring subroutine for rectangularily spaced data 
     *
     *     It emits calls to a line drawing subroutine supplied by the user
     *     which draws a contour map corresponding to real*4data on a randomly
     *     spaced rectangular grid. The coordinates emitted are in the same
     *     units given in the x() and y() arrays.
     *
     *     Any number of contour levels may be specified but they must be
     *     in order of increasing value.
     *
     *
     * @param d  - matrix of data to contour
     * @param ilb,iub,jlb,jub - index bounds of data matrix
     *
     *             The following two, one dimensional arrays (x and y) contain the horizontal and
     *             vertical coordinates of each sample points.
     * @param x  - data matrix column coordinates
     * @param y  - data matrix row coordinates
     * @param nc - number of contour levels
     * @param z  - contour levels in increasing order.
     * 
     */
    public void contour(double [][] d, int ilb, int iub, int jlb, int jub, double [] x, double [] y, int nc, double [] z) {
        int         m1;
        int         m2;
        int         m3;
        int         case_value;
        double      dmin;
        double      dmax;
        double      x1 = 0.0;
        double      x2 = 0.0;
        double      y1 = 0.0;
        double      y2 = 0.0;
        int         i,j,k,m;
       
        // The indexing of im and jm should be noted as it has to start from zero
        // unlike the fortran counter part
        int     [] im   = {0,1,1,0};
        int     [] jm   = {0,0,1,1};
        
        // Note that castab is arranged differently from the FORTRAN code because
        // Fortran and C/C++ arrays are transposed of each other, in this case
        // it is more tricky as castab is in 3 dimension
        int [][][] castab=
        {
            {
                {0,0,8},{0,2,5},{7,6,9}
            },
            {
                {0,3,4},{1,3,1},{4,3,0}
            },
            {
                {9,6,7},{5,2,0},{8,0,0}
            }
        };
        
        for (j=(jub-1);j>=jlb;j--) {
            for (i=ilb;i<=iub-1;i++) {
                double temp1,temp2;
                temp1 = Math.min(d[i][j],d[i][j+1]);
                temp2 = Math.min(d[i+1][j],d[i+1][j+1]);
                dmin  = Math.min(temp1,temp2);
                temp1 = Math.max(d[i][j],d[i][j+1]);
                temp2 = Math.max(d[i+1][j],d[i+1][j+1]);
                dmax  = Math.max(temp1,temp2);
                
                if (dmax>=z[0]&&dmin<=z[nc-1]) {
                    for (k=0;k<nc;k++) {
                        if (z[k]>=dmin&&z[k]<=dmax) {
                            for (m=4;m>=0;m--) {
                                if (m>0) {
                                    // The indexing of im and jm should be noted as it has to
                                    // start from zero
                                    h[m] = d[i+im[m-1]][j+jm[m-1]]-z[k];
                                    xh[m] = x[i+im[m-1]];
                                    yh[m] = y[j+jm[m-1]];
                                } else {
                                    h[0] = 0.25*(h[1]+h[2]+h[3]+h[4]);
                                    xh[0]=0.5*(x[i]+x[i+1]);
                                    yh[0]=0.5*(y[j]+y[j+1]);
                                }
                                if (h[m]>0.0) {
                                    sh[m] = 1;
                                } else if (h[m]<0.0) {
                                    sh[m] = -1;
                                } else
                                    sh[m] = 0;
                            }
                            //
                            // Note: at this stage the relative heights of the corners and the
                            // centre are in the h array, and the corresponding coordinates are
                            // in the xh and yh arrays. The centre of the box is indexed by 0
                            // and the 4 corners by 1 to 4 as shown below.
                            // Each triangle is then indexed by the parameter m, and the 3
                            // vertices of each triangle are indexed by parameters m1,m2,and
                            // m3.
                            // It is assumed that the centre of the box is always vertex 2
                            // though this isimportant only when all 3 vertices lie exactly on
                            // the same contour level, in which case only the side of the box
                            // is drawn.
                            //
                            //
                            //      vertex 4 +-------------------+ vertex 3
                            //               | \               / |
                            //               |   \    m-3    /   |
                            //               |     \       /     |
                            //               |       \   /       |
                            //               |  m=2    X   m=2   |       the centre is vertex 0
                            //               |       /   \       |
                            //               |     /       \     |
                            //               |   /    m=1    \   |
                            //               | /               \ |
                            //      vertex 1 +-------------------+ vertex 2
                            //
                            //
                            //
                            //               Scan each triangle in the box
                            //
                            for (m=1;m<=4;m++) {
                                m1 = m;
                                m2 = 0;
                                if (m!=4) {
                                    m3 = m+1;
                                } else {
                                    m3 = 1;
                                }
                                case_value = castab[sh[m1]+1][sh[m2]+1][sh[m3]+1];
                                if (case_value!=0) {
                                    switch (case_value) {
                                        case 1: // Line between vertices 1 and 2
                                            x1=xh[m1];
                                            y1=yh[m1];
                                            x2=xh[m2];
                                            y2=yh[m2];
                                            break;
                                        case 2: // Line between vertices 2 and 3
                                            x1=xh[m2];
                                            y1=yh[m2];
                                            x2=xh[m3];
                                            y2=yh[m3];
                                            break;
                                        case 3: // Line between vertices 3 and 1
                                            x1=xh[m3];
                                            y1=yh[m3];
                                            x2=xh[m1];
                                            y2=yh[m1];
                                            break;
                                        case 4: // Line between vertex 1 and side 2-3
                                            x1=xh[m1];
                                            y1=yh[m1];
                                            x2=xsect(m2,m3);
                                            y2=ysect(m2,m3);
                                            break;
                                        case 5: // Line between vertex 2 and side 3-1
                                            x1=xh[m2];
                                            y1=yh[m2];
                                            x2=xsect(m3,m1);
                                            y2=ysect(m3,m1);
                                            break;
                                        case 6: //  Line between vertex 3 and side 1-2
                                            x1=xh[m3];
                                            y1=yh[m3];
                                            x2=xsect(m1,m2);
                                            y2=ysect(m1,m2);
                                            break;
                                        case 7: // Line between sides 1-2 and 2-3
                                            x1=xsect(m1,m2);
                                            y1=ysect(m1,m2);
                                            x2=xsect(m2,m3);
                                            y2=ysect(m2,m3);
                                            break;
                                        case 8: // Line between sides 2-3 and 3-1
                                            x1=xsect(m2,m3);
                                            y1=ysect(m2,m3);
                                            x2=xsect(m3,m1);
                                            y2=ysect(m3,m1);
                                            break;
                                        case 9: // Line between sides 3-1 and 1-2
                                            x1=xsect(m3,m1);
                                            y1=ysect(m3,m1);
                                            x2=xsect(m1,m2);
                                            y2=ysect(m1,m2);
                                            break;
                                        default:
                                            break;
                                    }
                                    // Put your processing code here and comment out the printf
                                    //printf("%f %f %f %f %f\n",x1,y1,x2,y2,z[k]);
                                    render.drawContour(x1,y1,x2,y2,z[k]);
                                }
                            }
                        }
                    }
                }
            }
        }
    }

    private double xsect(int p1, int p2){
        return    (h[p2]*xh[p1]-h[p1]*xh[p2])/(h[p2]-h[p1]);
    }
    
    private double ysect(int p1, int p2){
        return (h[p2]*yh[p1]-h[p1]*yh[p2])/(h[p2]-h[p1]);
    }


}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美日韩免费视频| 精品日韩在线观看| 国产精品伊人色| 亚洲视频一区在线观看| 精品久久久久久亚洲综合网 | 国内精品国产成人| 亚洲永久精品大片| 国产精品理论片| www一区二区| 日韩欧美亚洲一区二区| 在线一区二区视频| 成人免费视频一区二区| 久久aⅴ国产欧美74aaa| 亚洲一区二区三区小说| 国产精品视频第一区| 精品久久久久久久久久久久包黑料 | 国产精品美女久久久久久久网站| 91精品一区二区三区久久久久久 | 成人av网站免费| 激情偷乱视频一区二区三区| 亚洲成人自拍网| 亚洲人妖av一区二区| 国产亚洲精品aa午夜观看| 欧美一级日韩免费不卡| 欧美亚洲图片小说| 91久久精品一区二区| 99久久精品免费| 91亚洲国产成人精品一区二区三| 成人av资源站| jlzzjlzz亚洲日本少妇| 成人午夜精品在线| 9色porny自拍视频一区二区| 成人美女视频在线观看18| 国内精品在线播放| 国产毛片一区二区| 国产美女精品一区二区三区| 狠狠色伊人亚洲综合成人| 精品一区二区三区不卡| 久久国产麻豆精品| 激情五月婷婷综合网| 精品一区二区久久| 国产一区二区三区av电影| 国产乱对白刺激视频不卡| 国产麻豆视频一区| 懂色av中文字幕一区二区三区 | 色国产综合视频| 欧美色网站导航| 制服丝袜亚洲网站| 欧美成人精品福利| 久久蜜桃av一区二区天堂 | 欧美美女视频在线观看| 欧美久久久久久久久久| 日韩欧美的一区二区| 国产亚洲污的网站| 国产精品久久久久久久浪潮网站 | 亚洲午夜av在线| 日本v片在线高清不卡在线观看| 视频一区免费在线观看| 激情综合色播五月| 成人a级免费电影| 欧美网站大全在线观看| 欧美一区永久视频免费观看| 日韩欧美电影一区| 国产精品久久久久久妇女6080| 中文字幕一区二区三区在线播放 | 成人av影院在线| 欧美性猛交xxxxxxxx| 欧美大黄免费观看| 国产精品电影院| 亚洲3atv精品一区二区三区| 久久精品国产免费| 99精品国产99久久久久久白柏| 欧洲色大大久久| 精品久久久久香蕉网| 中文字幕一区二区三区不卡在线| 亚洲成人免费看| 国产一区二区三区最好精华液| 91亚洲大成网污www| 欧美一区二区三区系列电影| 久久久亚洲午夜电影| 亚洲激情六月丁香| 黑人巨大精品欧美黑白配亚洲| 91麻豆成人久久精品二区三区| 91精品国产欧美一区二区成人| 国产精品五月天| 免费看欧美女人艹b| 成人av电影免费观看| 日韩一区二区不卡| 最新欧美精品一区二区三区| 美女尤物国产一区| 日本黄色一区二区| 久久久亚洲高清| 亚洲高清免费在线| youjizz久久| 精品国产一区二区三区忘忧草| 亚洲摸摸操操av| 国产精品538一区二区在线| 日本韩国欧美国产| 国产精品久久久一本精品| 青青草97国产精品免费观看 | 国产成人精品一区二| 欧美探花视频资源| 日韩一区中文字幕| 国产麻豆午夜三级精品| 91精品国产色综合久久ai换脸| 一区二区在线观看视频| 国产a级毛片一区| 欧美成人一区二区三区在线观看| 亚洲精品大片www| 99久久精品国产精品久久| 国产亚洲一本大道中文在线| 蜜乳av一区二区| 制服丝袜中文字幕一区| 亚洲国产精品久久久久秋霞影院| 99国产精品久久久| 日本一区二区三区电影| 久久99精品视频| 91精品国产免费久久综合| 亚洲国产一二三| 在线亚洲一区二区| 亚洲三级视频在线观看| 成人黄色片在线观看| 欧美激情一区不卡| 国产成人午夜精品影院观看视频 | 一区二区不卡在线播放 | 欧美猛男超大videosgay| 亚洲欧美二区三区| 色哟哟精品一区| 亚洲欧美另类在线| 91在线免费视频观看| 国产精品九色蝌蚪自拍| 岛国av在线一区| 国产精品不卡一区二区三区| 成人性生交大片免费看中文网站| 国产日韩精品视频一区| 成人午夜视频网站| 国产精品成人免费| 96av麻豆蜜桃一区二区| 亚洲精品视频自拍| 欧美性猛交xxxxxxxx| 亚洲6080在线| 日韩一区二区电影在线| 精品在线视频一区| 久久人人超碰精品| kk眼镜猥琐国模调教系列一区二区| 国产精品久久二区二区| 91啪亚洲精品| 午夜久久久久久久久| 3d动漫精品啪啪一区二区竹菊| 青青草91视频| 久久久久综合网| 成年人午夜久久久| 亚洲国产日日夜夜| 欧美变态tickling挠脚心| 国产一区二区在线视频| 日本一区二区三区在线不卡| 91蜜桃在线免费视频| 亚洲第一狼人社区| 日韩女优电影在线观看| 国产一区二区精品久久| 国产精品丝袜一区| 在线观看精品一区| 麻豆中文一区二区| 亚洲国产精品传媒在线观看| 色综合久久天天综合网| 日韩av不卡一区二区| 久久久99精品免费观看不卡| 91麻豆免费在线观看| 男女视频一区二区| 国产精品电影一区二区三区| 欧美日韩小视频| 国产精品自拍av| 一区二区三区在线观看视频| 欧美高清视频www夜色资源网| 国内精品不卡在线| 一区二区国产视频| 久久久久久一二三区| 一本一道波多野结衣一区二区| 免费在线视频一区| 国产精品久久影院| 欧美一二三四区在线| 成人不卡免费av| 秋霞午夜鲁丝一区二区老狼| 国产欧美日韩综合| 欧美一级日韩不卡播放免费| 99久久免费视频.com| 免费久久精品视频| 一区二区三区在线影院| 精品成人私密视频| 欧美在线观看一区| 国产v综合v亚洲欧| 蜜臀国产一区二区三区在线播放| 国产精品视频第一区| 欧美白人最猛性xxxxx69交| 色欧美乱欧美15图片| 国产v综合v亚洲欧| 日韩一区精品视频| 亚洲精品日产精品乱码不卡| ww亚洲ww在线观看国产| 欧美精品在线一区二区|