• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java Poly2Tri类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.poly2tri.Poly2Tri的典型用法代码示例。如果您正苦于以下问题:Java Poly2Tri类的具体用法?Java Poly2Tri怎么用?Java Poly2Tri使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Poly2Tri类属于org.poly2tri包,在下文中一共展示了Poly2Tri类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: initExample

import org.poly2tri.Poly2Tri; //导入依赖的package包/类
@Override
protected void initExample()
{
    super.initExample();

    Mesh mesh;
    Node node = new Node();
    node.setRenderState( new WireframeState() );
    _node.attachChild( node );
    Polygon poly;
    
    poly = createSquare();
    mesh = new Mesh();
    mesh.setDefaultColor( ColorRGBA.GREEN );
    mesh.setTranslation( 0, 0, 0 );
    node.attachChild( mesh );

    Poly2Tri.triangulate( poly );
    ArdorMeshMapper.updateTriangleMesh( mesh, poly );
}
 
开发者ID:orbisgis,项目名称:poly2tri.java,代码行数:21,代码来源:CDTSteinerPointExample.java


示例2: initExample

import org.poly2tri.Poly2Tri; //导入依赖的package包/类
@Override
protected void initExample()
{       
    super.initExample();

    Mesh mesh = new Mesh();
    mesh.setDefaultColor( ColorRGBA.BLUE );
    _node.attachChild( mesh );
  
    double scale = 100;
    int size = 1000;
    int index = (int)(Math.random()*size);
    List<TriangulationPoint> points = PointGenerator.uniformDistribution( size, scale );

    // Lets add a constraint that cuts the uniformDistribution in half
    points.add( new TPoint(0,scale/2) );
    points.add( new TPoint(0,-scale/2) );
    index = size; 
    
    ConstrainedPointSet cps = new ConstrainedPointSet( points, new int[]{ index, index+1 } );
    Poly2Tri.triangulate( cps );
    ArdorMeshMapper.updateTriangleMesh( mesh, cps );
}
 
开发者ID:orbisgis,项目名称:poly2tri.java,代码行数:24,代码来源:CDTUniformDistributionExample.java


示例3: initExample

import org.poly2tri.Poly2Tri; //导入依赖的package包/类
@Override
protected void initExample()
{
    super.initExample();
    
    Node node = new Node();
    node.setRenderState( new WireframeState() );
    _node.attachChild( node );
    Polygon circle;
    Polygon hole;
    
    circle = createCirclePolygon( 64, 25, 1 );
    hole = createCirclePolygon( 32, 25, 0.25, -0.5, -0.5 );
    circle.addHole( hole );
    hole = createCirclePolygon( 64, 25, 0.5,  0.25, 0.25 );
    circle.addHole( hole );

    Mesh mesh = new Mesh();
    mesh.setDefaultColor( ColorRGBA.RED );
    mesh.setTranslation( 0, 0, 0.01 );
    node.attachChild( mesh );

    Mesh mesh2 = new Mesh();
    mesh2.setDefaultColor( ColorRGBA.BLUE );
    _node.attachChild( mesh2 );
  
    Poly2Tri.triangulate( circle );
    ArdorMeshMapper.updateTriangleMesh( mesh, circle );
    ArdorMeshMapper.updateTriangleMesh( mesh2, circle );
}
 
开发者ID:orbisgis,项目名称:poly2tri.java,代码行数:31,代码来源:CDTHoleExample.java


示例4: main

import org.poly2tri.Poly2Tri; //导入依赖的package包/类
public static void main(final String[] args) 
    throws Exception
{
    PointSet ps = new PointSet( PointGenerator.uniformDistribution( 50, 500000 ) );
    for( int i=0; i<1; i++ )
    {
        Poly2Tri.triangulate( ps );
    }
    
    Thread.sleep( 10000000 );        
}
 
开发者ID:orbisgis,项目名称:poly2tri.java,代码行数:12,代码来源:ProfilingExample.java


示例5: DoTriangulation

import org.poly2tri.Poly2Tri; //导入依赖的package包/类
void DoTriangulation() {
	if (points.size() < 3)
		return;

	Polygon polygon = new Polygon(points);
	Poly2Tri.triangulate(polygon);
	triangles = polygon.getTriangles();
	println("DT: " + triangles);
	bShowTriangulation = true;
}
 
开发者ID:cacheflowe,项目名称:haxademic,代码行数:11,代码来源:Poly2TriTest.java


示例6: doTriangulation

import org.poly2tri.Poly2Tri; //导入依赖的package包/类
void doTriangulation() {
		Polygon polygon = new Polygon(points);
//		polygon.
		try {
			Poly2Tri.triangulate(polygon);
			triangles = polygon.getTriangles();
	//		println("DT: " + triangles);
		} catch(NullPointerException e) {
			
		}
	}
 
开发者ID:cacheflowe,项目名称:haxademic,代码行数:12,代码来源:KinectSilhouette.java


示例7: setVertices

import org.poly2tri.Poly2Tri; //导入依赖的package包/类
/**
 * Sets the polygonal shape of this node
 *
 * @param vertices           Vertex positions
 * @param textureCoordinates Corresponding vertex texture coordinates
 */
public void setVertices( Vector2f[] vertices, Vector2f[] textureCoordinates ) {
    if ( vertices.length > positionBuffer.capacity() ) {
        updateMaxVertexCount( Math.max( vertices.length, positionBuffer.capacity() + 20 ) ); // update by at least 20
    }

    positionBuffer.clear();
    textureBuffer.clear();
    indexBuffer.clear();

    // fill the position buffer
    for ( Vector2f vertex : vertices ) {
        positionBuffer.put( new float[] { vertex.x, vertex.y, 0 } );
    }
    positionBuffer.limit( positionBuffer.position() );
    normalBuffer.limit( positionBuffer.position() ); // also set the limit on the normal buffer to the same position

    // fill the texture buffer
    for ( Vector2f textureCoordinate : textureCoordinates ) {
        textureBuffer.put( new float[] { textureCoordinate.x, textureCoordinate.y } );
    }
    textureBuffer.limit( textureBuffer.position() );

    // ignore polygons with less than 3 vertices
    if ( vertices.length >= 3 ) {
        // make a list of polygon points that we can refer to later
        PolygonPoint[] points = new PolygonPoint[vertices.length];
        for ( short i = 0; i < points.length; i++ ) {
            points[i] = new IndexedPolygonPoint( i, vertices[i].getX(), vertices[i].getY() );
        }

        // create and triangulate our polygon
        Polygon polygon = new Polygon( points );
        Poly2Tri.triangulate( polygon );

        // iterate through the triangles, and add their indices into the index buffer
        List<DelaunayTriangle> triangles = polygon.getTriangles();
        for ( DelaunayTriangle triangle : triangles ) {
            // find the indices of the points
            short[] indices = new short[] {
                    ( (IndexedPolygonPoint) triangle.points[0] ).index,
                    ( (IndexedPolygonPoint) triangle.points[1] ).index,
                    ( (IndexedPolygonPoint) triangle.points[2] ).index };

            // add the indices into the index buffer
            indexBuffer.put( indices );
        }
    }
    indexBuffer.limit( indexBuffer.position() );

    // update the underlying vertex buffers
    getBuffer( Type.Position ).updateData( positionBuffer );
    getBuffer( Type.Normal ).updateData( normalBuffer );
    getBuffer( Type.TexCoord ).updateData( textureBuffer );
    getBuffer( Type.Index ).updateData( indexBuffer );

    // update various statistics and counts
    updateBound();
    updateCounts();
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:66,代码来源:PlanarPolygon.java


示例8: TriangulationProcess

import org.poly2tri.Poly2Tri; //导入依赖的package包/类
public TriangulationProcess( TriangulationAlgorithm algorithm )
{
    _algorithm = algorithm;
    _tcx = Poly2Tri.createContext( algorithm );
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:6,代码来源:TriangulationProcess.java


示例9: initExample

import org.poly2tri.Poly2Tri; //导入依赖的package包/类
@Override
    protected void initExample()
    {
        super.initExample();

        try
        {
            importShape(100);
        }
        catch( IOException e )
        {
            
        }
       
        _canvas.getCanvasRenderer().getCamera().setLocation(200, 200, 200);
        _canvas.getCanvasRenderer().getCamera().lookAt( 0, 0, 0, Vector3.UNIT_Z );
        
        _worldNode = new Node("shape");
//        _worldNode.setRenderState( new WireframeState() );
        _node.attachChild( _worldNode );

        buildSkyBox();
        
        Sphere seas = new Sphere("seas", Vector3.ZERO, 64, 64, 100.2f);
        seas.setDefaultColor( new ColorRGBA(0,0,0.5f,0.25f) );
        seas.getSceneHints().setRenderBucketType( RenderBucketType.Transparent );
        BlendState bs = new BlendState();
        bs.setBlendEnabled( true );
        bs.setEnabled( true );
        bs.setBlendEquationAlpha( BlendEquation.Max );
        bs.setSourceFunction(BlendState.SourceFunction.SourceAlpha);
        bs.setDestinationFunction(BlendState.DestinationFunction.OneMinusSourceAlpha);
        seas.setRenderState( bs );
        ZBufferState zb = new ZBufferState();
        zb.setEnabled( true );
        zb.setWritable( false );
        seas.setRenderState( zb );
        _worldNode.attachChild( seas );

        Sphere core = new Sphere("seas", Vector3.ZERO, 16, 16, 10f);
        core.getSceneHints().setLightCombineMode( LightCombineMode.Replace );
        MaterialState ms = new MaterialState();
        ms.setEmissive( new ColorRGBA(0.8f,0.2f,0,0.9f) );
        core.setRenderState( ms );
        _worldNode.attachChild( core );

        Mesh mesh;
        for( PolygonSet ps : _countries )
        {
            Poly2Tri.triangulate( ps );
            float value = 1-0.9f*(float)Math.random();
            for( Polygon p : ps.getPolygons() )
            {
                mesh = new Mesh();
                mesh.setDefaultColor( new ColorRGBA( value, value, value, 1.0f ) );
                _worldNode.attachChild( mesh );
              
                ArdorMeshMapper.updateTriangleMesh( mesh, p, _wgs84 );
            }
        }
    }
 
开发者ID:orbisgis,项目名称:poly2tri.java,代码行数:62,代码来源:WorldExample.java



注:本文中的org.poly2tri.Poly2Tri类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java AbstractEntryProcessor类代码示例发布时间:2022-05-23
下一篇:
Java Message类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap