當前位置: 首頁>>代碼示例>>Java>>正文


Java Point3d.set方法代碼示例

本文整理匯總了Java中javax.vecmath.Point3d.set方法的典型用法代碼示例。如果您正苦於以下問題:Java Point3d.set方法的具體用法?Java Point3d.set怎麽用?Java Point3d.set使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在javax.vecmath.Point3d的用法示例。


在下文中一共展示了Point3d.set方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getCoords

import javax.vecmath.Point3d; //導入方法依賴的package包/類
/**
 * Return agents coordinates.
 * 
 * @return agent point3d .
 */
public void getCoords(Point3d coord) {
	Vector3d t = v1;
	translation.get(t);
	coord.set(t.x, t.y, t.z);
}
 
開發者ID:glaudiston,項目名稱:project-bianca,代碼行數:11,代碼來源:SimpleAgent.java

示例2: castTo

import javax.vecmath.Point3d; //導入方法依賴的package包/類
public int castTo( float[] pos, BufferedImage image, Point3d worldHit, Vector3d worldNormal ) {

		com.jme3.math.Vector3f worldDir = new com.jme3.math.Vector3f( pos[ 0 ], pos[ 1 ], pos[ 2 ] );
		worldDir = worldDir.subtract( Jme3z.to(location) );

		com.jme3.math.Vector3f dir = inverseGeomRot.mult( worldDir );

		double angle = (( Math.atan2( -dir.x, dir.z ) + Math.PI ) % ( Math.PI * 2 )) / ( Math.PI * 2 );
		double elevation = (Math.atan2( -dir.y, Math.sqrt( dir.x * dir.x + dir.z * dir.z ) ) + Math.PI / 2) / Math.PI ;

		double[] rgb = new double[3];
		
		if (image != null)
		{
			double  x = angle * image.getWidth(), 
					y = elevation * image.getHeight(), 
					xF = x - Math.floor( x ), 
					yF = y - Math.floor( y );

			get( image, Math.floor( x ), Math.floor( y ), ( 1 - xF ) * ( 1 - yF ), rgb );
			get( image, Math.ceil ( x ), Math.floor( y ), xF * ( 1 - yF ), rgb );
			get( image, Math.ceil ( x ), Math.ceil ( y ), xF * yF, rgb );
			get( image, Math.floor( x ), Math.ceil ( y ), ( 1 - xF ) * yF, rgb );
		}
		
		if (worldHit != null) {
			
			worldHit.x = Double.NaN;
			
			if (planeNameCache.get() != name) {
				planeNameCache.set( name );
				planeMaskCache.set (getPlanePano() );
			}
			
			if ( planeMaskCache.get() != null ) {
				
				double  x = Mathz.clamp( (1-angle) * planeMaskCache.get().getWidth(), 0, planeMaskCache.get().getWidth()-1 ),
						y = elevation * planeMaskCache.get().getHeight();
				
				Color c = new Color ( planeMaskCache.get().getRGB( (int) x, (int) y ) );
				
				int planeNo = (c.getRed() + c.getGreen() + c.getBlue() ) / 3;
				
				if (planeNo < planes.size() && planeNo != 0) {
					
					LinearForm3D plane = new LinearForm3D ( planes.get( planeNo ) );
					
					{
						double tmp = plane.B;
						plane.B = plane.C;
						plane.C = tmp;
						plane.D = -plane.D;
						
						plane.A = -plane.A;
						
					}
					
					Point3d pt = plane.collide( new Point3d(), Jme3z.from( dir ) );
					
					{
						
						com.jme3.math.Vector3f ptm = Jme3z.to( pt );
						
						worldHit.set( Jme3z.from ( geomRot.mult( ptm ) ) );
						worldHit.add( location );

						worldNormal.set( Jme3z.from ( geomRot.mult( Jme3z.to(plane.normal()) ) ) );
					}
				}
			}
			 
			
		}
		
		return Colour.asInt( (int) rgb[ 0 ], (int) rgb[ 1 ], (int) rgb[ 2 ] );
	}
 
開發者ID:twak,項目名稱:chordatlas,代碼行數:77,代碼來源:Pano.java


注:本文中的javax.vecmath.Point3d.set方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。