当前位置: 首页>>代码示例>>Java>>正文


Java Loopz类代码示例

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


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

示例1: createBlocks

import org.twak.utils.collections.Loopz; //导入依赖的package包/类
private void createBlocks( Closer<Point3d> closer, LoopL<Point3d> polies ) {
	Map<Point3d, Integer> bMap = closer.findMap();
	
	if (TweedSettings.settings.snapFootprintVert > 0) {
		Loopz.dirtySnap(polies, TweedSettings.settings.snapFootprintVert);
	}
	
	for ( Loop<Point3d> poly : polies) 
		if (poly.count() > 0) {
			int key = bMap.get ( poly.start.get() );
			LoopL<Point3d> loopl = blocks.get(key);
			if (loopl == null)
				blocks.put(key, loopl = new LoopL<>() );
			
			if (TweedSettings.settings.calculateFootprintNormals) {
					if (Loopz.area( Loopz.to2dLoop( poly, 1, null ) ) < 0)
						poly.reverse();
				}
			
			loopl.add(poly);
		}
}
 
开发者ID:twak,项目名称:chordatlas,代码行数:23,代码来源:GISGen.java

示例2: blockSelected

import org.twak.utils.collections.Loopz; //导入依赖的package包/类
@Override
public void blockSelected( LoopL<Point3d> polies, BlockGen blockGen ) {
	
	Point2d cen = Loopz.average( Loopz.to2dLoop( polies, 1, null ) );
	
	for (File f : new File (tweed.DATA+File.separator +"solutions").listFiles()) {
		try {
		Point2d fp = FeatureCache.fileToCenter( f.getName() );
		if (fp.distanceSquared( cen ) < 1) {
			new Thread( () -> load( f, true ) ).start();
			return;
		}
		}
		catch (Throwable th) {
			System.out.println( "unable to read solution "+f.getName() );
		}
	}
	
	JOptionPane.showMessageDialog( tweed.frame(), "Can't find solution for center " + cen );
}
 
开发者ID:twak,项目名称:chordatlas,代码行数:21,代码来源:ResultsGen.java

示例3: fromLoop

import org.twak.utils.collections.Loopz; //导入依赖的package包/类
public static Mesh fromLoop( Loop<Point3d> in ) {

		if ( !in.holes.isEmpty() ) {
			LoopL<Point3d> res =new LoopL<Point3d>( in );
			in = res.isEmpty() ? in : res.get( 0 );
		}

		Mesh m = new Mesh();

		m.setMode( Mesh.Mode.Triangles );

		List<Integer> inds = new ArrayList<>();
		List<Float> pos = new ArrayList<>();
		List<Float> norms = new ArrayList<>();

		Loopz.triangulate( in, false, inds, pos, norms );

		m.setBuffer( Type.Index, 3, Arrayz.toIntArray( inds ) );
		m.setBuffer( Type.Position, 3, Arrayz.toFloatArray( pos ) );
		m.setBuffer( Type.Normal, 3, Arrayz.toFloatArray( norms ) );

		return m;
	}
 
开发者ID:twak,项目名称:siteplan,代码行数:24,代码来源:Jme3z.java

示例4: doProfile

import org.twak.utils.collections.Loopz; //导入依赖的package包/类
private void doProfile() {
	new Thread() {
		@Override
		public void run() {
			tweed.frame.addGen( profileGen = new ProfileGen(BlockGen.this, Loopz.toXZLoop( polies ), tweed), true);
		}
	}.start();
}
 
开发者ID:twak,项目名称:chordatlas,代码行数:9,代码来源:BlockGen.java

示例5: BlockGen

import org.twak.utils.collections.Loopz; //导入依赖的package包/类
public BlockGen( File l, Tweed tweed, LoopL<Point3d> polies ) {
	
	super ( new File(l, GISGen.CROPPED_OBJ ).getPath().substring( Tweed.JME.length() ), tweed);

	this.polies = polies;
	this.root = l;
	this.name = "block";
	this.transparency = 0;
	
	this.center = Loopz.average( Loopz.to2dLoop( polies, 1, null ) );
	System.out.println("creating block with name: " + nameCoords() );
}
 
开发者ID:twak,项目名称:chordatlas,代码行数:13,代码来源:BlockGen.java

示例6: findSE

import org.twak.utils.collections.Loopz; //导入依赖的package包/类
private static double[] findSE( MiniFacade mf, Line l, List<Face> chain ) {
	
	double mlen = l.length();
	
	double lowest = Double.MAX_VALUE;
	Face bestFace = null;
	
	for (Face f : chain) {
		double[] bounds = Loopz.minMax( f.getLoopL() );
		if (bounds[5] - bounds[4] > 1 && bounds[4] < lowest) {
			bestFace = f;
			lowest = bounds[4];
		}
	}
	
	if (bestFace == null)
		return new double[] {mf.left, mf.left+ mf.width}; //!
	
	List<Double> params = bestFace.getLoopL().streamE().map( p3 -> l.findPPram( new Point2d ( p3.x, p3.y ) ) ).collect( Collectors.toList() );
	
	double[] out = new double[] {
		params.stream().mapToDouble( x->x ).min().getAsDouble() * mlen,
		params.stream().mapToDouble( x->x ).max().getAsDouble() * mlen
	};

	// if good, stretch whole minifacade to mesh
	if ( Mathz.inRange( ( out[1] - out[0]) / (mf.width), 0.66, 1.4 ) )
		return out;
	
	// else snap to the closest of start/end
	if ( 
			l.fromPPram( out[0] / mlen ).distance( l.fromPPram( mf.left / mlen ) ) >
			l.fromPPram( out[1] / mlen ).distance( l.fromPPram( (mf.left + mf.width ) / mlen ) ) )
		return new double[] {out[1] - mf.width, out[1]}; 
	else
		return new double[] {out[0], out[0] + mf.width }; 
}
 
开发者ID:twak,项目名称:chordatlas,代码行数:38,代码来源:Greeble.java

示例7: findRect

import org.twak.utils.collections.Loopz; //导入依赖的package包/类
protected DRectangle findRect( Loop<Point2d> rect ) {
	double[] bounds = Loopz.minMax2d( rect );
	
	DRectangle all = new DRectangle(
			bounds[0], 
			bounds[2], 
			bounds[1] - bounds[0], 
			bounds[3] - bounds[2] );
	
	return all;
}
 
开发者ID:twak,项目名称:chordatlas,代码行数:12,代码来源:Greeble.java

示例8: capAt

import org.twak.utils.collections.Loopz; //导入依赖的package包/类
public void capAt (double cap, HeresTheArea hta) {
	
	  qu.add(new HeightEvent() {

		  public double getHeight() {
              return cap;
          }

          public boolean process(Skeleton skel) {
        	  
              SkeletonCapUpdate capUpdate = new SkeletonCapUpdate(skel);

              
              LoopL<Corner> flatTop = capUpdate.getCap(cap);
              
              capUpdate.update(new LoopL<>(), new SetCorrespondence<Corner, Corner>(), new DHash<Corner, Corner>());
              
              LoopL<Point3d> togo =
                      flatTop.new Map<Point3d>()
                      {
                          @Override
                          public Point3d map( Loopable<Corner> input )
                          {
                              return new Point3d( input.get().x, input.get().y, input.get().z );
                          }
                      }.run();
                      skel.output.addNonSkeletonOutputFace( togo, new Vector3d( 0, 0, 1 ) );
                      
                      if (hta != null)
                    	  hta.heresTheArea( Loopz.area3( togo ) );
                      
              DebugDevice.dump("post cap dump", skel);

              skel.qu.clearFaceEvents();
              skel.qu.clearOtherEvents();
              
              return true;
          }
      });
}
 
开发者ID:twak,项目名称:campskeleton,代码行数:41,代码来源:Skeleton.java

示例9: meanModeHeightColor

import org.twak.utils.collections.Loopz; //导入依赖的package包/类
public static void meanModeHeightColor( Loop<Point2d> pts, SuperFace sf, BlockGen blockgen ) {
		
		double[] minMax = Loopz.minMax2d( pts );

		double sample = 2;

		double missCost = 30;
		
		if (sf.colors != null)
			sf.colors.clear();
		
		sf.heights.clear();
		
		int insideGIS = 0, outsideGIS = 0;

		LoopL<Point2d> gis = blockgen.profileGen.gis;
		gis = Loopz.removeInnerEdges( gis );
		gis = Loopz.removeNegativeArea( gis, -1 );
		gis = Loopz.mergeAdjacentEdges( gis, 1, 0.05 );
		
		for ( double x = minMax[ 0 ]; x < minMax[ 1 ]; x += sample )
			for ( double y = minMax[ 2 ]; y < minMax[ 3 ]; y += sample ) {
				
				Point2d p2d = new Point2d( x, y );
				
				if ( Loopz.inside( p2d, pts ) ) {

						CollisionResults results = new CollisionResults();
						blockgen.gNode.collideWith( new Ray( Jme3z.toJmeV( x, 0, y ), UP ), results );
						CollisionResult cr = results.getFarthestCollision();

						double height;

						if ( cr != null ) {

							height = cr.getDistance();
							sf.heights.add( height );
							
							if ( sf != null && sf.colors != null ) {
								ColorRGBA col = getColor( cr.getGeometry(), cr.getContactPoint(), cr.getTriangleIndex(), blockgen.tweed );
								sf.colors.add( new float[] { col.r, col.g, col.b } );
							}
						}
						
						
					if ( Loopz.inside( p2d, gis ) ) { 
						insideGIS ++;
//						PaintThing.debug( Color.yellow, 1, p2d);
					}
					else {
						outsideGIS ++;
//						PaintThing.debug( Color.green, 1, p2d);
					}
				}
			}
		

		if ( sf.heights.size() < 2 )
			sf.height = -Double.MAX_VALUE;
		else if ( TweedSettings.settings.useGis &&  insideGIS  <  gisInterior * outsideGIS )
			sf.height = -missCost;
		else {
			sf.updateHeight();
		}
		
		sf.maxProfHeights = new ArrayList();
		
		for (HalfEdge e : sf) {
			SuperEdge se = ((SuperEdge) e);
			if ( se.profLine!= null ) 
				for (Prof p : ((SuperLine)se.profLine).getMega().getTween( e.start, e.end, 0.3) )
					sf.maxProfHeights.add( p.get( p.size()-1 ).y );
		}
	}
 
开发者ID:twak,项目名称:chordatlas,代码行数:75,代码来源:SkelFootprint.java

示例10: ProfileGen

import org.twak.utils.collections.Loopz; //导入依赖的package包/类
public ProfileGen( BlockGen blockGen, LoopL<Point2d> gis, Tweed tweed ) {

		super( "profiles", tweed );

		tweed.frame.removeGens( ProfileGen.class );
		tweed.frame.removeGens( JmeGen.class );
		
		this.blockGen = blockGen;
		
		this.gis = gis;
//		this.gis = Loopz.removeInnerEdges( gisIn );
		this.gis = Loopz.removeNegativeArea( this.gis, -1 );
		this.gis = Loopz.mergeAdjacentEdges( this.gis, 1, 0.05 );
		
		this.extent = blockGen.getCroppedMesh().findExtent();
		this.gisBias = new GBias ( Loopz.toGraph( this.gis ), 1 );
		
		new Thread(() -> faces = findMegaFaces( TweedSettings.settings.profileVSampleDist ) ).start();
	}
 
开发者ID:twak,项目名称:chordatlas,代码行数:20,代码来源:ProfileGen.java

示例11: add

import org.twak.utils.collections.Loopz; //导入依赖的package包/类
public void add (LoopL<? extends Point2d> flat, Matrix4d to3d) {
	LoopL<Point3d> td = Loopz.transform( Loopz.to3d( flat, 0, 1 ), to3d );
	add( td, true );
}
 
开发者ID:twak,项目名称:siteplan,代码行数:5,代码来源:MeshBuilder.java

示例12: add3d

import org.twak.utils.collections.Loopz; //导入依赖的package包/类
public void add3d (LoopL<? extends Point3d> ll, Matrix4d to3d) {
	LoopL<Point3d> td = Loopz.transform( ll, to3d );
	add( td, true );
}
 
开发者ID:twak,项目名称:siteplan,代码行数:5,代码来源:MeshBuilder.java

示例13: distance

import org.twak.utils.collections.Loopz; //导入依赖的package包/类
protected double distance( LoopL<Point2d> gis2, Point2d start ) {

		double out = Double.MAX_VALUE;
		
		for (Loop<Point2d> p : gis2) {
			
			if (Loopz.inside( start, p ))
				return 0;
			
			for (Loopable<Point2d> ll : p.loopableIterator() ) 
				out = Math.min (out, new Line (ll.get(), ll.getNext().get()).distance( start ));
		}
		
		return out;
	}
 
开发者ID:twak,项目名称:chordatlas,代码行数:16,代码来源:ProfileGen.java

示例14: facadeSelected

import org.twak.utils.collections.Loopz; //导入依赖的package包/类
public void facadeSelected( LoopL<Point3d> list, BlockGen block ) {

		//		if (block == null) {
		//			JOptionPane.showMessageDialog( null, "generate mesh for block first" );
		//			return;
		//		}
		
		double[] minMax = Loopz.minMax( list );// Polygonz.findBounds( polies, min, max );

		Loopz.expand( minMax, 30 );

		Map<Point2d, Pano> panos = new HashMap<>();

		for ( Gen gen : tweed.frame.gens( PanoGen.class ) )
			for ( Pano pg : ( (PanoGen) gen ).getPanos() ) {
				Point2d pt = new Point2d( pg.location.x, pg.location.z );

				if ( pt.x > minMax[ 0 ] && pt.x < minMax[ 1 ] && pt.y > minMax[ 4 ] && pt.y < minMax[ 5 ] )

					panos.put( pt, pg );
			}

		List<Point3d> objPoints = null;
		if ( block != null ) {
			objPoints = new ObjRead( block.getCroppedFile() ).points();
		}

		FacadeFinder ff = new FacadeFinder( Loopz.toXZLoop( list ), panos, objPoints, block, tweed.frame.getGenOf( PlanesGen.class ) );

		Point2d cen = Loopz.average( Loopz.to2dLoop( list, 1, null ) );
		
		renderFacades( block == null ? null : block.gNode, cen.x+"_"+cen.y, ff );
	}
 
开发者ID:twak,项目名称:chordatlas,代码行数:34,代码来源:FacadeTool.java

示例15: project

import org.twak.utils.collections.Loopz; //导入依赖的package包/类
public boolean project (Matrix4d to2d, Matrix4d to3d, Loop<? extends Point2d> facade, LinearForm3D facePlane, Vector3d perp ) {

			boolean allInside = true;
			
			for (int i = 0; i < 4; i++) {
				
//				Point3d proj = new Point3d(corners[i]);
				
				Point3d sec = facePlane.collide( corners[i], perp );
				
				if (sec != null) {
				
				to2d.transform( sec );
				
				boolean inside = Loopz.inside( new Point2d (sec.x, sec.z), facade );
				
				allInside &= inside;
				
				if ( inside ) {
					sec.y = 0;
					to3d.transform( sec );
					found[i] = sec;
				}
				}
			}
			
			return allInside;
		}
 
开发者ID:twak,项目名称:chordatlas,代码行数:29,代码来源:Greeble.java


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