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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? pnt.java

?? 實現(xiàn)Delaunay三角網(wǎng)生成
?? JAVA
?? 第 1 頁 / 共 2 頁
字號:
/*
 * Copyright (c) 2005 by L. Paul Chew.
 * 
 * Permission is hereby granted, without written agreement and without
 * license or royalty fees, to use, copy, modify, and distribute this
 * software and its documentation for any purpose, subject to the following 
 * conditions:
 *
 * The above copyright notice and this permission notice shall be included 
 * in all copies or substantial portions of the Software.
 * 
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 
 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 
 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 
 * DEALINGS IN THE SOFTWARE.
 */

/**
 * Points in Euclidean space, implemented as double[].
 * 
 * Includes simple geometric operations.
 * Uses matrices; a matrix is represented as an array of Pnts.
 * Uses simplices; a simplex is represented as an array of Pnts.
 * 
 * @author Paul Chew
 * 
 * Created July 2005.  Derived from an earlier, messier version.
 */
public class Pnt {
    
    private double[] coordinates;          // The point's coordinates
    
    /**
     * Constructor.
     * @param coords the coordinates
     */
    public Pnt (double... coords) {
        /* Copying is done here to ensure that Pnt's coords cannot be altered.
         * This is necessary because the vararg notation actually creates a
         * constructor with double[] as its argument.
         */
        coordinates = new double[coords.length];
        System.arraycopy(coords, 0, coordinates, 0, coords.length);
    }
    
    /**
     * Create a String for this Pnt.
     * @return a String representation of this Pnt.
     */
    public String toString () {
        if (coordinates.length == 0) return "()";
        String result = "Pnt(" + coordinates[0];
        for (int i = 1; i < coordinates.length; i++)
            result = result + "," + coordinates[i];
        result = result + ")";
        return result;
    }
    
    /**
     * Equality.
     * @param other the other Object to compare to
     * @return true iff the Pnts have the same coordinates
     */
    public boolean equals (Object other) {
        if (!(other instanceof Pnt)) return false;
        Pnt p = (Pnt) other;
        if (this.coordinates.length != p.coordinates.length) return false;
        for (int i = 0; i < this.coordinates.length; i++)
            if (this.coordinates[i] != p.coordinates[i]) return false;
        return true;
    }
    
    /**
     * HashCode.
     * @return the hashCode for this Pnt
     */
    public int hashCode () {
        int hash = 0;
        for (double c: this.coordinates) {
            long bits = Double.doubleToLongBits(c);
            hash = (31*hash) ^ (int)(bits ^ (bits >> 32));
        }
        return hash;
    }
    
    /* Pnts as vectors */
    
    /**
     * @return the specified coordinate of this Pnt
     * @throws ArrayIndexOutOfBoundsException for bad coordinate
     */
    public double coord (int i) {
        return this.coordinates[i];
    }
    
    /**
     * @return this Pnt's dimension.
     */
    public int dimension () {
        return coordinates.length;
    }
    
    /**
     * Check that dimensions match.
     * @param p the Pnt to check (against this Pnt)
     * @return the dimension of the Pnts
     * @throws IllegalArgumentException if dimension fail to match
     */
    public int dimCheck (Pnt p) {
        int len = this.coordinates.length;
        if (len != p.coordinates.length)
            throw new IllegalArgumentException("Dimension mismatch");
        return len;
    }
    
    /**
     * Create a new Pnt by adding additional coordinates to this Pnt.
     * @param coords the new coordinates (added on the right end)
     * @return a new Pnt with the additional coordinates
     */
    public Pnt extend (double... coords) {
        double[] result = new double[coordinates.length + coords.length];
        System.arraycopy(coordinates, 0, result, 0, coordinates.length);
        System.arraycopy(coords, 0, result, coordinates.length, coords.length);
        return new Pnt(result);
    }
    
    /**
     * Dot product.
     * @param p the other Pnt
     * @return dot product of this Pnt and p
     */
    public double dot (Pnt p) {
        int len = dimCheck(p);
        double sum = 0;
        for (int i = 0; i < len; i++)
            sum += this.coordinates[i] * p.coordinates[i];
        return sum;
    }
    
    /**
     * Magnitude (as a vector).
     * @return the Euclidean length of this vector
     */
    public double magnitude () {
        return Math.sqrt(this.dot(this));
    }
    
    /**
     * Subtract.
     * @param p the other Pnt
     * @return a new Pnt = this - p
     */
    public Pnt subtract (Pnt p) {
        int len = dimCheck(p);
        double[] coords = new double[len];
        for (int i = 0; i < len; i++)
            coords[i] = this.coordinates[i] - p.coordinates[i];
        return new Pnt(coords);
    }
    
    /**
     * Add.
     * @param p the other Pnt
     * @return a new Pnt = this + p
     */
    public Pnt add (Pnt p) {
        int len = dimCheck(p);
        double[] coords = new double[len];
        for (int i = 0; i < len; i++)
            coords[i] = this.coordinates[i] + p.coordinates[i];
        return new Pnt(coords);
    }
    
    /**
     * Angle (in radians) between two Pnts (treated as vectors).
     * @param p the other Pnt
     * @return the angle (in radians) between the two Pnts
     */
    public double angle (Pnt p) {
        return Math.acos(this.dot(p) / (this.magnitude() * p.magnitude()));
    }
    
    /**
     * Perpendicular bisector of two Pnts.
     * Works in any dimension.  The coefficients are returned as a Pnt of one
     * higher dimension (e.g., (A,B,C,D) for an equation of the form
     * Ax + By + Cz + D = 0).
     * @param point the other point
     * @return the coefficients of the perpendicular bisector
     */
    public Pnt bisector (Pnt point) {
        int dim = dimCheck(point);
        Pnt diff = this.subtract(point);
        Pnt sum = this.add(point);
        double dot = diff.dot(sum);
        return diff.extend(-dot / 2);
    }
    
    /* Pnts as matrices */
    
    /**
     * Create a String for a matrix.
     * @param matrix the matrix (an array of Pnts)
     * @return a String represenation of the matrix
     */
    public static String toString (Pnt[] matrix) {
        StringBuilder buf = new StringBuilder("{");
        for (Pnt row: matrix) buf.append(" " + row);
        buf.append(" }");
        return buf.toString();
    }
    
    /**
     * Compute the determinant of a matrix (array of Pnts).
     * This is not an efficient implementation, but should be adequate 
     * for low dimension.
     * @param matrix the matrix as an array of Pnts
     * @return the determinnant of the input matrix
     * @throws IllegalArgumentException if dimensions are wrong
     */
    public static double determinant (Pnt[] matrix) {
        if (matrix.length != matrix[0].dimension())
            throw new IllegalArgumentException("Matrix is not square");
        boolean[] columns = new boolean[matrix.length];
        for (int i = 0; i < matrix.length; i++) columns[i] = true;
        try {return determinant(matrix, 0, columns);}
        catch (ArrayIndexOutOfBoundsException e) {
            throw new IllegalArgumentException("Matrix is wrong shape");
        }
    }

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美日韩国产美| 精品久久五月天| 亚洲123区在线观看| 欧美色成人综合| 麻豆一区二区三| 精品国产一二三区| www.亚洲人| 亚洲一二三四区| 欧美成人一区二区三区片免费 | 中文字幕一区在线观看视频| 成人av动漫在线| 午夜婷婷国产麻豆精品| 婷婷中文字幕综合| 国产一区中文字幕| 日韩一区二区三区三四区视频在线观看| 久久久久亚洲综合| 久久99精品国产| 精品国产成人在线影院| 午夜视频一区在线观看| 国产专区综合网| 精品黑人一区二区三区久久 | 亚洲人成在线观看一区二区| 99久久精品国产观看| 欧美国产禁国产网站cc| 91小视频在线免费看| 另类人妖一区二区av| 亚洲精品第一国产综合野| 欧美日韩一级二级| 丰满少妇久久久久久久| 亚洲成av人片一区二区梦乃| 国产精品无圣光一区二区| 51精品国自产在线| 色婷婷综合久色| 国产一区二区三区观看| 日韩av中文在线观看| 自拍偷拍欧美精品| 国产欧美日韩中文久久| 欧美二区在线观看| 色一情一伦一子一伦一区| 国产麻豆91精品| 亚洲男女一区二区三区| 欧美激情中文字幕一区二区| 91精品欧美综合在线观看最新| gogogo免费视频观看亚洲一| 午夜精品一区二区三区三上悠亚 | 日本亚洲电影天堂| 亚洲一区二区三区小说| 国产日产欧产精品推荐色| 日韩视频在线观看一区二区| 欧美三级欧美一级| 欧美三级中文字幕在线观看| 在线视频一区二区三区| 91丨porny丨蝌蚪视频| 国产成人8x视频一区二区| 五月激情丁香一区二区三区| 一区二区成人在线观看| 国产欧美视频一区二区三区| 91精品欧美福利在线观看| 91麻豆视频网站| 欧美日韩在线免费视频| 色女孩综合影院| 高清不卡一区二区在线| www.日本不卡| 91天堂素人约啪| 国产成人av一区| 豆国产96在线|亚洲| 成人黄色777网| 91麻豆福利精品推荐| 日本道免费精品一区二区三区| 91亚洲精品久久久蜜桃| 337p亚洲精品色噜噜狠狠| 在线播放欧美女士性生活| 日韩欧美不卡一区| 成人av在线影院| 性感美女久久精品| 日韩电影网1区2区| 热久久免费视频| 久久疯狂做爰流白浆xx| 国产精品一区免费视频| 成人丝袜高跟foot| 91黄色免费看| 日韩一本二本av| 久久色.com| 国产精品久久久久久久浪潮网站| 亚洲小说欧美激情另类| 免费成人你懂的| 国产69精品久久久久777| 色欧美日韩亚洲| 欧美日韩国产高清一区二区三区 | 一区二区三区日韩欧美精品| 亚洲国产成人av| 美女精品一区二区| 国内精品在线播放| 欧美系列在线观看| 日韩精品最新网址| 国产精品福利av| 亚洲v日本v欧美v久久精品| 韩国一区二区三区| 色综合天天综合在线视频| 9191久久久久久久久久久| 国产欧美日韩卡一| 亚洲一区二区欧美| 国产乱码字幕精品高清av| 不卡免费追剧大全电视剧网站| 成人激情综合网站| 日韩一级成人av| 一色屋精品亚洲香蕉网站| 日本 国产 欧美色综合| 成+人+亚洲+综合天堂| 欧美高清视频www夜色资源网| 久久久久久久av麻豆果冻| 久久久91精品国产一区二区精品 | 国内精品久久久久影院色| 色综合久久综合网欧美综合网| 精品国产3级a| 亚洲a一区二区| 东方欧美亚洲色图在线| 91行情网站电视在线观看高清版| 久久精品在线免费观看| 日本不卡一区二区三区高清视频| 成人午夜电影久久影院| 91精品国产品国语在线不卡| 国产亚洲一本大道中文在线| 欧美精品在欧美一区二区少妇| 国产日韩欧美不卡在线| 亚洲va国产天堂va久久en| 99免费精品视频| 26uuu精品一区二区| 精品综合免费视频观看| 欧美亚洲国产一区二区三区va| 日本一区免费视频| 国产精品1区2区3区在线观看| 欧美日本乱大交xxxxx| 一区免费观看视频| 日韩av高清在线观看| 欧美日韩精品电影| 日韩美女啊v在线免费观看| 另类小说欧美激情| 精品99999| 看电视剧不卡顿的网站| 97精品久久久午夜一区二区三区| 国产精品高潮呻吟久久| 国产成人自拍高清视频在线免费播放| 91久久精品午夜一区二区| 亚洲一区二区三区四区在线免费观看| 成人福利视频网站| 国产三级精品三级| 成人av在线资源网站| 亚洲国产成人在线| 国产精品影视网| 欧美激情一区二区在线| 国产一区91精品张津瑜| xnxx国产精品| 成人激情文学综合网| 中文字幕的久久| 粉嫩av一区二区三区在线播放| 中文在线一区二区| 99精品在线观看视频| 中文字幕一区二区三区四区| 91啪亚洲精品| 亚洲综合免费观看高清完整版 | 欧美男女性生活在线直播观看| 亚洲精品你懂的| 欧美亚洲综合另类| 免费人成网站在线观看欧美高清| 精品日韩欧美在线| k8久久久一区二区三区| 亚州成人在线电影| 久久精品欧美一区二区三区不卡 | 99久久免费精品高清特色大片| 亚洲人吸女人奶水| 欧美高清一级片在线| 国产高清精品在线| 亚洲视频香蕉人妖| 91精品国产手机| 成人av在线资源| 青青草成人在线观看| 国产日韩欧美高清| 欧美日韩国产高清一区二区| 国产精品911| 亚洲va天堂va国产va久| 久久免费午夜影院| 日本精品一级二级| 一区二区在线免费| 一区二区在线观看免费视频播放| 国产成人精品免费| 久久综合九色综合欧美就去吻| 久久九九久精品国产免费直播| 精品处破学生在线二十三| 久久九九久久九九| 夜夜夜精品看看| 午夜成人免费电影| 国产一区二区三区久久久| 91伊人久久大香线蕉| 在线电影院国产精品| 国产午夜精品久久久久久免费视 | 日韩成人一级大片| 久久精品亚洲麻豆av一区二区 | 精品一区二区三区在线视频| 亚洲色图第一区|