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

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

?? hiddenlinerenderer.java

?? 基于java的3d開發庫。對坐java3d的朋友有很大的幫助。
?? JAVA
字號:
//===========================================================================//=-------------------------------------------------------------------------=//= References:                                                             =//= [FOLE1992] Foley, vanDam, Feiner, Hughes. "Computer Graphics,           =//=          principles and practice" - second edition, Addison Wesley,     =//=          1992.                                                          =//= [APPE1967] Appel, Arthur. "The notion of quantitative invisivility and  =//=          the machine rendering of solids". Proceedings, ACM National    =//=          meeting 1967.                                                  =//=-------------------------------------------------------------------------=//= Module history:                                                         =//= - September 5 2007 - Oscar Chavarro: Original base version              =//===========================================================================package vsdk.toolkit.render;// Java classesimport java.util.ArrayList;import java.util.Collections;// VitralSDK classesimport vsdk.toolkit.common.VSDK;import vsdk.toolkit.common.Vector3D;import vsdk.toolkit.common.Ray;import vsdk.toolkit.environment.Camera;import vsdk.toolkit.environment.scene.SimpleBody;import vsdk.toolkit.environment.geometry.Geometry;import vsdk.toolkit.environment.geometry.InfinitePlane;import vsdk.toolkit.environment.geometry.PolyhedralBoundedSolid;import vsdk.toolkit.environment.geometry.polyhedralBoundedSolidNodes._PolyhedralBoundedSolidFace;import vsdk.toolkit.environment.geometry.polyhedralBoundedSolidNodes._PolyhedralBoundedSolidLoop;import vsdk.toolkit.environment.geometry.polyhedralBoundedSolidNodes._PolyhedralBoundedSolidHalfEdge;import vsdk.toolkit.environment.geometry.polyhedralBoundedSolidNodes._PolyhedralBoundedSolidEdge;import vsdk.toolkit.environment.geometry.polyhedralBoundedSolidNodes._PolyhedralBoundedSolidVertex;class _AppelEdgeSegment extends RenderingElement implements Comparable <_AppelEdgeSegment>{    /// Distance from start to end with respect to line parameter    public double t;    public int deltaQI; // Relative change in quantitative invisibility    public int compareTo(_AppelEdgeSegment other)    {        if ( this.t < other.t ) return -1;        else if ( this.t > other.t ) return 1;        return 0;    }}class _AppelEdgeCache extends RenderingElement{    public static final int HIDDEN_LINE = 0;    public static final int VISIBLE_LINE = 1;    public static final int CONTOUR_LINE = 2;    public int edgeType;    /// True if current line starts on the end of a previous one in the same    /// solid and with the same quantitative invisibility. Whe this happens,    /// quantitative invisibility can be acumulated in the edge sequence,    /// otherwise must be calculated.    boolean onSequence;    public Vector3D start;    public Vector3D end;    /// d = start - end    public Vector3D d;    /// `visibleEdgeForContourLine` contains an explicit reference to the    /// planar surface marked as "S" on figure 5 on [APPE1967].    public _PolyhedralBoundedSolidFace visibleEdgeForContourLine;    public void setStart(Vector3D s)    {        start = new Vector3D(s);    }    public void setEnd(Vector3D e)    {        end = new Vector3D(e);    }}/**This class implements the Appel's algorithm for hidden line rendering. :)*/public class HiddenLineRenderer extends RenderingElement{    private static int    computeQuantitativeInvisibility(ArrayList <SimpleBody> solids,        Camera camera, _AppelEdgeCache edge)    {        int qi = 0;        int i;        for ( i = 0; i < solids.size(); i++ ) {            qi += solids.get(i).computeQuantitativeInvisibility(                camera.getPosition(), edge.start.add(edge.d.multiply(10*VSDK.EPSILON)));        }        return qi;    }    /**    */    private static void buildCache(ArrayList <SimpleBody> solids,                                   SimpleBody body,                                    ArrayList <_AppelEdgeCache> cache,                                   ArrayList <_AppelEdgeCache> contourCache,                                   Camera camera)    {        Geometry g = body.getGeometry();        if ( g == null ) {            return;        }        g = g.exportToPolyhedralBoundedSolid();        solids.add(body);        PolyhedralBoundedSolid solid = (PolyhedralBoundedSolid)g;        int i;        long l = 0;        _PolyhedralBoundedSolidFace face1;        _PolyhedralBoundedSolidFace face2;        boolean f1, f2;        _AppelEdgeCache materialLine;        Vector3D prevEnd = new Vector3D();        for ( i = 0; i < solid.edgesList.size(); i++ ) {            _PolyhedralBoundedSolidEdge e = solid.edgesList.get(i);            int start, end;            start = e.getStartingVertexId();            end = e.getEndingVertexId();            if ( start >= 0 && end >= 0 ) {                Vector3D startPosition;                Vector3D endPosition;                Vector3D middle;                Vector3D n;                startPosition = e.leftHalf.startingVertex.position;                endPosition = e.rightHalf.startingVertex.position;                if ( startPosition != null && endPosition != null ) {                    //--------------------------------------------------------                    face1 = e.leftHalf.parentLoop.parentFace;                    face2 = e.rightHalf.parentLoop.parentFace;                    f1 = face1.isVisibleFrom(camera) >= 0;                    f2 = face2.isVisibleFrom(camera) >= 0;                    //--------------------------------------------------------                    materialLine = new _AppelEdgeCache();                    materialLine.setStart(startPosition);                    materialLine.setEnd(endPosition);                    materialLine.d = endPosition.substract(startPosition);                    if ( l > 0 &&                         VSDK.vectorDistance(prevEnd, startPosition) <                              VSDK.EPSILON ) {                        materialLine.onSequence = true;                    }                    else {                        materialLine.onSequence = false;                    }                    if ( !f1 && !f2 ) {                        // Totally hidden lines                        materialLine.edgeType = materialLine.HIDDEN_LINE;                    }                    else if ( f1 && !f2 || !f1 && f2 ) {                        // Contour lines                        materialLine.edgeType = materialLine.CONTOUR_LINE;                        if ( f1 ) {                            materialLine.visibleEdgeForContourLine = face1;                        }                        else {                            materialLine.visibleEdgeForContourLine = face2;                        }                        contourCache.add(materialLine);                    }                    else {                        // Visible non contour lines                        materialLine.edgeType = materialLine.VISIBLE_LINE;                    }                    cache.add(materialLine);                    //--------------------------------------------------------                    prevEnd.clone(endPosition);                    l++;                }            }        }    }    /**    Given a viewing camera and a set of bodies, this method generates three    sets of lines for visible line rendering, as described in [APPE1967] and    [FOLE1992].15.3.2. The lines are in 3D space and contains viewer's    perception to respect to which line segments are visible (as part of the    object contour or normal) and which line segments are visible.    */    public static void executeAppelAlgorithm(        ArrayList <SimpleBody> inSimpleBodyArray,        Camera inCamera,        ArrayList <Vector3D> outContourLineEndPoints,        ArrayList <Vector3D> outVisibleLineEndPoints,        ArrayList <Vector3D> outHiddenLineEndPoints)    {        //-----------------------------------------------------------------        ArrayList <_AppelEdgeCache> cache = new ArrayList <_AppelEdgeCache>();        ArrayList <_AppelEdgeCache> contourCache = new ArrayList <_AppelEdgeCache>();        int i;        //-----------------------------------------------------------------        ArrayList <SimpleBody> solids = new ArrayList <SimpleBody>();        for ( i = 0; i < inSimpleBodyArray.size(); i++ ) {            buildCache(solids, inSimpleBodyArray.get(i), cache, contourCache, inCamera);        }        //-----------------------------------------------------------------        _AppelEdgeCache edge;        for ( i = 0; i < cache.size(); i++ ) {            edge = cache.get(i);            // Note that a "line to be drawn" is any line in the cache            // not marked as a hidden line.            switch ( edge.edgeType ) {              case _AppelEdgeCache.HIDDEN_LINE:                outHiddenLineEndPoints.add(new Vector3D(edge.start));                outHiddenLineEndPoints.add(new Vector3D(edge.end));                break;              case _AppelEdgeCache.CONTOUR_LINE:              case _AppelEdgeCache.VISIBLE_LINE:                processLineToBeDrawn(                    solids,                    edge, inCamera, outContourLineEndPoints,                    outVisibleLineEndPoints, outHiddenLineEndPoints,                    contourCache);                break;              default: break;            }        }        //-----------------------------------------------------------------        cache = null;        contourCache = null;    }    private static void    processLineToBeDrawn(        ArrayList <SimpleBody> solids,        _AppelEdgeCache edge,        Camera camera,        ArrayList <Vector3D> outContourLineEndPoints,        ArrayList <Vector3D> outVisibleLineEndPoints,        ArrayList <Vector3D> outHiddenLineEndPoints,        ArrayList <_AppelEdgeCache> contourCache)    {        //- Compute the sweep plane triangle ------------------------------        // Defines plane "SP1" on figure 5 of [APPE1967]        Vector3D sp1a, sp1b, sp1c;        sp1a = edge.start;        sp1b = edge.end;        sp1c = camera.getPosition();        //-----------------------------------------------------------------        // Defines plane "SP2" on figure 5 of [APPE1967]        Vector3D sp2a, sp2b, sp2c;        Vector3D K; // Preceding point "K" on figure 5 of [APPE1967]        Vector3D J; // "K" projected on "SP2"        Ray ray = new Ray(new Vector3D(), new Vector3D());        double t0;        int i;        int pos;        _AppelEdgeCache cl;          // Line "CL" on figure 5 of [APPE1967]        Vector3D p = new Vector3D(); // Point "PP1" on figure 5 of [APPE1967]        Vector3D n = new Vector3D();        ArrayList<_AppelEdgeSegment> segments;        _AppelEdgeSegment segment;        InfinitePlane plane;        segments = new ArrayList<_AppelEdgeSegment>();        segment = new _AppelEdgeSegment();        segment.t = 0;        segment.deltaQI = 0;        segments.add(segment);        sp2c = camera.getPosition();        for ( i = 0; i < contourCache.size(); i++ ) {            cl = contourCache.get(i);            ray.origin.clone(cl.start.add(cl.d.multiply(VSDK.EPSILON)));            ray.direction.clone(cl.d);            t0 = ray.direction.length() - 2*VSDK.EPSILON;            ray.direction.normalize();            if (             Geometry.doIntersectionWithTriangle(ray, sp1a, sp1b, sp1c, p, n) &&             ray.t < t0            ) {                // The breaking point in the current testing edge corresponding                // to the passing contour is the piercing point where the                // edge intersects with the contour's sweeping plane.                sp2a = cl.start;                sp2b = cl.end;                plane = new InfinitePlane(sp2a, sp2b, sp2c);                ray.origin.clone(edge.start);                ray.direction.clone(edge.d);                ray.direction.normalize();                if ( plane.doIntersection(ray) ) {                    segment = new _AppelEdgeSegment();                    segment.t = ray.t / edge.d.length(); // Point "PP2"                    // Determine the change in quantitative invisibility...                    K = edge.start.add(edge.d.multiply(segment.t-2*VSDK.EPSILON));                    // Project K on SP2                    ray.origin.clone(K);                    ray.direction = sp2c.substract(K);                    ray.direction.normalize();                    if ( cl.visibleEdgeForContourLine.containingPlane.                         doIntersection(ray) ) {                        J = ray.origin.add(ray.direction.multiply(ray.t));                        pos = cl.visibleEdgeForContourLine.testPointInside(J, VSDK.EPSILON);                        if ( pos == Geometry.INSIDE || pos == Geometry.LIMIT ) {                            segment.deltaQI = 1;                        }                        else {                            segment.deltaQI = -1;                        }                        segments.add(segment);                    }                }            }        }        segment = new _AppelEdgeSegment();        segment.t = 1;        segments.add(segment);        //-----------------------------------------------------------------        Collections.sort(segments);        //-----------------------------------------------------------------        Vector3D pos1, pos2;        int qi;        qi = computeQuantitativeInvisibility(solids, camera, edge);        for ( i = 0; i < segments.size()-1; i++ ) {            segment = segments.get(i);            qi += segment.deltaQI;            pos1 = edge.start.add(edge.d.multiply(segment.t));            segment = segments.get(i+1);            pos2 = edge.start.add(edge.d.multiply(segment.t));            if ( qi == 0 ) {                if ( edge.edgeType == edge.CONTOUR_LINE ) {                    outContourLineEndPoints.add(new Vector3D(pos1));                    outContourLineEndPoints.add(new Vector3D(pos2));                }                else {                    outVisibleLineEndPoints.add(new Vector3D(pos1));                    outVisibleLineEndPoints.add(new Vector3D(pos2));                }            }            else {                outHiddenLineEndPoints.add(new Vector3D(pos1));                outHiddenLineEndPoints.add(new Vector3D(pos2));            }        }        segments = null;    }}//===========================================================================//= EOF                                                                     =//===========================================================================

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产精品电影一区二区| 国产精品对白交换视频| 欧美专区在线观看一区| 日本二三区不卡| 一本到不卡精品视频在线观看| 成人黄色av电影| 99这里只有精品| 一本大道av一区二区在线播放| 99精品在线观看视频| 色噜噜狠狠色综合欧洲selulu| 91麻豆免费观看| 欧美丝袜第三区| 日韩视频在线一区二区| 欧美成人精品1314www| 久久久久久久av麻豆果冻| 国产欧美综合色| 亚洲免费资源在线播放| 亚洲444eee在线观看| 久久福利资源站| 盗摄精品av一区二区三区| 成人丝袜高跟foot| 欧美中文一区二区三区| 日韩一区二区精品在线观看| 久久综合九色综合久久久精品综合| 国产欧美中文在线| 亚洲一区二区视频在线观看| 裸体一区二区三区| 99国产精品久久久久久久久久久| 欧美综合一区二区| 337p日本欧洲亚洲大胆精品| 国产精品成人网| 日本欧美一区二区| 99riav久久精品riav| 欧美v日韩v国产v| 国产精品久久久久久久浪潮网站| 午夜精品久久久久久久蜜桃app| 国产一区二区伦理| 在线这里只有精品| 国产日韩精品一区二区三区在线| 亚洲www啪成人一区二区麻豆| 国产在线播放一区二区三区| 欧美日韩大陆一区二区| 国产精品免费久久久久| 青青草一区二区三区| 91一区二区在线| 久久久精品影视| 青青草精品视频| 欧美日韩国产高清一区| 亚洲伦在线观看| 风流少妇一区二区| 久久综合久久99| 久久精品国产一区二区三区免费看 | 国产在线看一区| 国产夫妻精品视频| 欧美一区二区黄| 亚洲精品自拍动漫在线| 国产凹凸在线观看一区二区| 日韩一区二区在线观看视频播放| 一区二区国产视频| 不卡的av网站| 国产精品欧美精品| 国产在线视频一区二区三区| 欧美一区二区三级| 日韩高清一区二区| 欧美日韩亚洲高清一区二区| 亚洲一二三区视频在线观看| 色婷婷亚洲婷婷| 亚洲最大成人网4388xx| 色欧美乱欧美15图片| 综合中文字幕亚洲| www.亚洲在线| 亚洲图片激情小说| 色综合一个色综合亚洲| 亚洲欧美日韩国产另类专区| gogogo免费视频观看亚洲一| 国产精品三级av| 91在线视频免费91| 亚洲国产一区在线观看| 欧美精品v国产精品v日韩精品| 亚洲国产日日夜夜| 欧美天堂亚洲电影院在线播放| 亚洲一卡二卡三卡四卡无卡久久| 欧美特级限制片免费在线观看| 亚洲成人免费电影| 欧美成人a在线| 国产在线精品免费av| 国产精品美女久久久久久| 日本韩国一区二区| 午夜久久久影院| 精品日韩欧美在线| aaa亚洲精品一二三区| 国产精品对白交换视频| 欧美性大战久久久久久久| 日韩av网站免费在线| 国产夜色精品一区二区av| 波多野结衣中文字幕一区 | 国产欧美一区二区精品性色超碰| 丁香激情综合五月| 一区二区视频在线| 日韩精品专区在线影院重磅| 成av人片一区二区| 丝袜美腿亚洲一区二区图片| 国产偷v国产偷v亚洲高清| 日本高清不卡一区| 国产麻豆视频一区二区| 亚洲四区在线观看| 欧美成人一区二区| 91精品福利在线| 国产经典欧美精品| 污片在线观看一区二区| 国产女同互慰高潮91漫画| 欧美伊人久久大香线蕉综合69 | 2024国产精品| 色哟哟在线观看一区二区三区| 亚洲v精品v日韩v欧美v专区 | 蜜臀99久久精品久久久久久软件| 国产精品少妇自拍| 日韩欧美一区电影| 在线一区二区观看| 激情久久五月天| 亚洲一区二区四区蜜桃| 亚洲国产精品激情在线观看| 91精品国产综合久久福利| 99久久99久久精品国产片果冻| 国产自产2019最新不卡| 亚洲不卡av一区二区三区| 最近日韩中文字幕| 久久久蜜桃精品| 日韩久久免费av| 91精品国产综合久久久久久漫画 | 日韩一级高清毛片| 91捆绑美女网站| 国产精品1区2区| 蜜桃一区二区三区在线| 亚洲va欧美va人人爽| 国产精品电影一区二区三区| 久久嫩草精品久久久精品一| 欧美一级国产精品| 欧美精品色一区二区三区| 91色乱码一区二区三区| 丁香婷婷深情五月亚洲| 国产老女人精品毛片久久| 美国av一区二区| 日韩成人精品在线| 视频一区在线视频| 日韩高清欧美激情| 亚洲va韩国va欧美va精品| 亚洲午夜精品一区二区三区他趣| 亚洲免费观看高清完整版在线| 国产精品久久久久三级| 国产精品久久久久久久蜜臀| 国产精品国产精品国产专区不片| 国产精品拍天天在线| 亚洲三级小视频| 亚洲男人天堂av| 亚洲国产精品久久不卡毛片| 亚洲图片欧美一区| 日本美女一区二区| 国产精品亚洲午夜一区二区三区 | 欧美在线一区二区| wwwwww.欧美系列| 久久女同性恋中文字幕| 国产免费久久精品| 亚洲人成网站色在线观看| 亚洲人成网站精品片在线观看| 亚洲综合区在线| 日韩国产在线一| 激情综合网av| 白白色 亚洲乱淫| 欧美日韩一区中文字幕| 精品国产三级电影在线观看| 国产日产欧美一区二区三区| 中文字幕一区三区| 亚洲国产综合91精品麻豆| 久久精品国产99久久6| 福利电影一区二区| 欧美色倩网站大全免费| 亚洲精品在线网站| 亚洲三级电影全部在线观看高清| 首页亚洲欧美制服丝腿| 国产黑丝在线一区二区三区| 在线观看av一区二区| 日韩精品中文字幕在线一区| 国产精品国产三级国产aⅴ中文| 一区二区三区av电影| 国产一区亚洲一区| 欧美在线免费视屏| www国产成人免费观看视频 深夜成人网| 中文字幕一区二区三区蜜月| 日韩一区精品字幕| 99久久99久久免费精品蜜臀| 日韩一区二区三区四区| 亚洲欧洲性图库| 日本不卡视频一二三区| 成人高清视频在线| 日韩欧美一级二级三级| 亚洲综合丁香婷婷六月香| 极品尤物av久久免费看| 欧美亚洲一区三区| 国产精品丝袜黑色高跟|