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

? 歡迎來(lái)到蟲(chóng)蟲(chóng)下載站! | ?? 資源下載 ?? 資源專(zhuān)輯 ?? 關(guān)于我們
? 蟲(chóng)蟲(chóng)下載站

?? point3d.java

?? 用java開(kāi)發(fā)的一個(gè)實(shí)施策略游戲源碼 值得學(xué)習(xí)一下
?? JAVA
字號(hào):
/*
	Netwar
	Copyright (C) 2002  Daniel Grund, Kyle Kakligian, Jason Komutrattananon, & Brian Hibler.

	This file is part of Netwar.

	Netwar is free software; you can redistribute it and/or modify
	it under the terms of the GNU General Public License as published by
	the Free Software Foundation; either version 2 of the License, or
	(at your option) any later version.

	Netwar is distributed in the hope that it will be useful,
	but WITHOUT ANY WARRANTY; without even the implied warranty of
	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
	GNU General Public License for more details.

	You should have received a copy of the GNU General Public License
	along with Netwar; if not, write to the Free Software
	Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

package netwar.utils.vectorgraphics;
import netwar.utils.Trig;

/** This class is used to represent a location or vector in gamespace. A Point3D can be translated into a Point2D using the internal transform matrix, and that matrix can be manipulated for zooming and changes in angle.<br>
 * <br>
 * Note that the get_ functions return a new Point2D/3D while the do_ funtions affect <B>this</B> Point3D.
 * @author Daniel Grund
  * @author Kyle Kakligian
 */
public class Point3D {
    
    /** X-axis value or length.
     */
    public float x;
    
    /** Y-axis value or length.
     */
    public float y;
    
    /** Z-axis value or length.
     */    
	public float   z;

        /** Constructor for the orgin.
         */        
	public Point3D() {}
        /** Constructs a Point3D
         * @param X X-axis value or length.
         * @param Y Y-axis value or length.
         * @param Z Z-axis value or length.
         */        
	public Point3D(float X, float Y, float Z) {x=X; y=Y; z=Z;}
        /** Constructs a Point3D, converting the doubles to floats.
         * @param X X-axis value or length.
         * @param Y Y-axis value or length.
         * @param Z Z-axis value or length.
         */        
	public Point3D(double X, double Y, double Z) {x=(float)X; y=(float)Y; z=(float)Z;}
        /** Copy constructor
         * @param v Copy.
         */        
	public Point3D(Point3D v) {x = v.x; y = v.y; z = v.z;}

        /** Returns a new Point3D that is the scalar product of <B>this</B> one.
         * @param scalar Multiplier
         * @return Returns a new Point3D
         */        
	public Point3D getProduct(float scalar) {
		return new Point3D(x * scalar, y * scalar, z * scalar); }
        /** Evalutates the dot (scalar) product of two vectors.
         * @param v Secound vector in the dot product operation.
         * @return Scalar.
         */        
	public float getDotProduct(Point3D v) {
		return x*v.x + y*v.y + z*v.z; }
        /** Evalutates the cross (vector) product of two vectors.
         * @param v Secound vector in the cross product operation.
         * @return Returns a new Point3D
         */        
	public Point3D getCrossProduct(Point3D v) {
		return new Point3D(y * v.z - z * v.y,
		      z * v.x - x * v.z,
		      x * v.y - y * v.x); }
        /** Returns the sum of <B>this</B> Point3D and the given vector.
         * @param v The vector to add to <B>this</B>.
         * @return Returns a new Point3D.
         */        
	public Point3D getSum(Point3D v) {
		return new Point3D(x + v.x, y + v.y, z + v.z); }
        /** Returns the vector difference of <B>this</B> Point3D and the given Point3D.
         * @param v The secound point in this operation that the returned vector points to. (<B>this</B> + returned = <I>v</I>)
         * @return Returns a new Point3D
         */        
	public Point3D getDifference(Point3D v) {
		return new Point3D(x - v.x, y - v.y, z - v.z); }
        /** Returns a new Point3D that is the scalar product of <B>this</B> one.
         * @param scalar Multiplier.
         * @return Returns a reference to <B>this</B> where the result is stored.
         */        
	public Point3D doProduct(float scalar) {
		x *= scalar;
		y *= scalar;
		z *= scalar; 
		return this;
	}
        /** Evalutates the cross (vector) product of two vectors.
         * @param v Secound vector in the cross product operation.
         * @return Returns a reference to <B>this</B> where the result is stored.
         */        
	public Point3D doCrossProduct(Point3D v) {
		float X = x; float Y = y; float Z = z;
		x = Y * v.z - Z * v.y;
		y = Z * v.x - X * v.z;
		z = X * v.y - Y * v.x;
		return this;
	}
        /** Returns the sum of <B>this</B> Point3D and the given vector.
         * @param v The vector to add to <B>this</B>.
         * @return Returns a reference to <B>this</B> where the result is stored.
         */        
	public Point3D doSum(Point3D v) {
		x += v.x; 
		y += v.y;
		z += v.z; 
		return this;
	}
        /** Returns the vector difference of <B>this</B> Point3D and the given Point3D.
         * @param v The secound point in this operation that the returned vector points to. (pre<B>this</B> + post<B>this</B> = <I>v</I>)
         * @return Returns a reference to <B>this</B> where the result is stored.
         */        
	public Point3D doDifference(Point3D v) {
		x -= v.x; 
		y -= v.y;
		z -= v.z; 
		return this;
	}

        /** Changes the <B>length</B> of this vector to 1. The direction is kept constant.
         */        
	public void Normalize() {
		float r = getLength();
		x /= r;
		y /= r;
		z /= r;
	}
        /** Returns the distance to the orgin, or, returns the length of the vector. (Whether <B>this</B> is a vector or a point, both values are the same but have different meanings)
         * @return Length.
         * @see #getLengthSquared getLengthSquared()
         */        
	public float getLength() {
		return (float)Math.sqrt(x*x+y*y+z*z);
	}
	//Faster version of get length.
	//Don't need to squareroot if you compare squares instead.
        /** Same as getLength() without the square root. Since all distances are positive and reletive, we can compare their square distances. This is an optimization.
         * @return x*x + y*y + z*z
         * @see #getLength getLength()
         */        
	public float getLengthSquared() {
		return (x*x+y*y+z*z);
	}
	
	/** Rotates point around the line containing linePt which extends in the direction indicated by vector by an angle theta.
         * Returns a point, after it is transformed.
         * @return point, after it is transformed.
         * @param linePt The point which is on the line.
         * @param vec The direction which the line extends from linePt.
         * @param theta The angle to rotate by. */
	public Point3D doRotate(Point3D linePt, Point3D vec, int theta) {
		double c = Trig.cos(theta);
		double s = Trig.sin(theta);
		double X = vec.x;
		double Y = vec.y;
		double Z = vec.z;
		double D2 = (float)vec.getLengthSquared();
		double D = (float)Math.sqrt(D2);

		if(this == linePt) return this;
		doDifference(linePt);
		double newX = (x) * ( c + (1 - c) * X * X / D2 )
		     + (y) * ( ( (1 - c) * (X * Y / D ) - (Z * s ) ) / D)
		     + (z) * ( ( (1 - c) * (X * Z / D ) + (Y * s ) ) / D ) 
		     + linePt.x;
		double newY = (x) * ( ( (1 - c) * (Y * X / D ) + (Z * s ) ) / D )
		     + (y) * ( c + (1 - c) * Y * Y / D2 )
		     + (z) * ( ( (1 - c) * (Y * Z / D ) - (X * s ) ) / D )
		     + linePt.y;
		double newZ = (x) * ( ( (1 - c) * (X * Z / D ) - (Y * s ) ) / D )
		     + (y) * ( ( (1 - c) * (Y * Z / D ) + (X * s ) ) / D )
		     + (z) * ( c + (1 - c) * Z * Z / D2 )
		     + linePt.z;

		x = (float)newX;
		y = (float)newY;
		z = (float)newZ;

		return this;
	}
	/** Rotates point around the line containing linePt which extends in the direction indicated by vector by an angle theta.
         * Returns a new point, which is the transformed point: the original point is left intact.
         * @return A new Point, which is the rotation of point.
         * @param linePt The point which is on the line.
         * @param vec The direction which the line extends from linePt.
         * @param theta The angle to rotate by. */
	public Point3D getRotate(Point3D linePt, Point3D vec, int theta) {
		double c = Trig.cos(theta);
		double s = Trig.sin(theta);
		double X = vec.x;
		double Y = vec.y;
		double Z = vec.z;
		double D2 = (float)vec.getLengthSquared();
		double D = (float)Math.sqrt(D2);

		Point3D newPt = getDifference(linePt);
		double newX = (x) * ( c + (1 - c) * X * X / D2 )
		     + (y) * ( ( (1 - c) * (X * Y / D ) - (Z * s ) ) / D)
		     + (z) * ( ( (1 - c) * (X * Z / D ) + (Y * s ) ) / D ) 
		     + linePt.x;
		double newY = (x) * ( ( (1 - c) * (Y * X / D ) + (Z * s ) ) / D )
		     + (y) * ( c + (1 - c) * Y * Y / D2 )
		     + (z) * ( ( (1 - c) * (Y * Z / D ) - (X * s ) ) / D )
		     + linePt.y;
		double newZ = (x) * ( ( (1 - c) * (X * Z / D ) - (Y * s ) ) / D )
		     + (y) * ( ( (1 - c) * (Y * Z / D ) + (X * s ) ) / D )
		     + (z) * ( c + (1 - c) * Z * Z / D2 )
		     + linePt.z;

		newPt.x = (float)newX;
		newPt.y = (float)newY;
		newPt.z = (float)newZ;

		return newPt;
	}
        /** Implementation of Object.equals().
         * Compares two Point3Ds for equality. This operation is reflexive, symmetric, and transitive.
         * For any reference value x, x.equals(null) returns false.
         *
         * @param p The reference Point3D with which to compare.
         * @return true if <B>this</B> Point3D is the same as the <I>p</I> argument; false otherwise.
         */        
	public boolean equals(Point3D p)
	{  if(p==null) return false; return (x == p.x && y == p.y && z == p.z); }
        /** Implementation of Object.equals().
         * Compares two Point3Ds for equality. This operation is reflexive, symmetric, and transitive.
         * For any reference value x, x.equals(null) returns false.
         *
         * @param X The x-axis value with which to compare.
         * @param Y The y-axis value with which to compare.
         * @param Z The z-axis value with which to compare.
         * @return true if <B>this</B> Point3D is the same as described in the arguments; false otherwise.
         */        
	public boolean equals(float X, float Y, float Z)
	{  return (x == X && y == Y && z == Z);  }
        /** Sets <B>this</B> point as a copy of the given one.
         * @param p The Point3D to copy.
         * @return Returns a reference to itself.
         */        
	public Point3D set(Point3D p)
	{  x = p.x; y = p.y; z = p.z; return this; }
        /** Sets <B>this</B> point from the given information.
         * @param X The new x-axis value.
         * @param Y The new y-axis value.
         * @param Z The new z-axis value.
         * @return Returns a reference to itself.
         */        
	public Point3D set(float X, float Y, float Z)
	{  x = X;   y = Y;   z = Z; return this;  }
        /** (0,0,0)
         */        
	public static Point3D origin = new Point3D(0,0,0);
        /** +east direction
         */        
	public static Point3D unitEast = new Point3D(1,0,0);
        /** +north direction
         */        
	public static Point3D unitNorth = new Point3D(0,1,0);
        /** +up direction
         */        
	public static Point3D unitUp = new Point3D(0,0,1);
        /** +west direction
         */        
	public static Point3D unitWest = new Point3D(-1,0,0);
        /** +south direction
         */        
	public static Point3D unitSouth = new Point3D(0,-1,0);
        /** +down direction
         */        
	public static Point3D unitDown = new Point3D(0,0,-1);
}

?? 快捷鍵說(shuō)明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
成人妖精视频yjsp地址| 成人在线综合网| 亚洲成人自拍网| 一区二区三区中文字幕| 亚洲美女偷拍久久| 亚洲精选免费视频| 亚洲精品亚洲人成人网在线播放| 国产精品久久久久久久久晋中| 国产精品色哟哟网站| 国产欧美日韩在线观看| 国产精品私人影院| 中文字幕日韩av资源站| 亚洲日本免费电影| 亚洲自拍偷拍网站| 天天色综合天天| 麻豆极品一区二区三区| 精品中文av资源站在线观看| 国产在线麻豆精品观看| 国产精品羞羞答答xxdd| 成人禁用看黄a在线| 波波电影院一区二区三区| 91网上在线视频| 欧美日韩精品免费观看视频| 欧美一区二区三区小说| 久久综合九色综合欧美亚洲| 欧美国产欧美综合| 亚洲精品中文在线观看| 午夜精品久久久久久久久| 久久精品国产久精国产爱| 国产精品18久久久久久久久| 波多野结衣91| 久久新电视剧免费观看| 中日韩av电影| 激情欧美日韩一区二区| 国产伦理精品不卡| 9l国产精品久久久久麻豆| 欧美色电影在线| 日韩一级片在线观看| 中文字幕高清不卡| 亚洲制服丝袜在线| 国产在线精品一区二区夜色| www.99精品| 欧美精品久久一区| 久久久不卡网国产精品一区| 亚洲精品大片www| 六月婷婷色综合| 99在线精品观看| 91精品欧美久久久久久动漫| 国产日韩欧美在线一区| 五月婷婷综合网| 国产白丝精品91爽爽久久 | 在线观看亚洲精品| 欧美精品丝袜中出| 国产三级久久久| 亚洲丰满少妇videoshd| 国产一区二区三区黄视频 | 8x福利精品第一导航| 久久影音资源网| 亚洲精品国产第一综合99久久| 日本va欧美va精品发布| 成人午夜碰碰视频| 337p亚洲精品色噜噜| 国产精品对白交换视频| 久久国产精品一区二区| 91亚洲男人天堂| 久久久影视传媒| 视频在线在亚洲| 99精品视频一区| 精品日韩一区二区三区| 一区二区激情视频| 成人免费av在线| 精品三级在线看| 日日摸夜夜添夜夜添国产精品| www.66久久| 久久久久久久久久久久久久久99| 亚洲成人你懂的| 91在线你懂得| 国产精品你懂的| 国产一区二区电影| 正在播放亚洲一区| 夜夜嗨av一区二区三区中文字幕| 成人免费视频一区二区| 精品久久五月天| 热久久免费视频| 欧美日韩在线播放三区四区| 亚洲天堂免费在线观看视频| 欧美丰满一区二区免费视频| 日韩二区三区四区| 国产精品亚洲人在线观看| 91精品黄色片免费大全| 亚洲国产精品视频| 91麻豆免费看片| 中文字幕在线免费不卡| 国v精品久久久网| 久久久国产精华| 国产资源精品在线观看| 日韩精品一区二区三区swag| 日本aⅴ亚洲精品中文乱码| 精品视频一区二区三区免费| 亚洲综合一区二区| 91国偷自产一区二区开放时间| 亚洲欧洲日韩一区二区三区| 丰满白嫩尤物一区二区| 国产日韩欧美综合一区| 5月丁香婷婷综合| 亚洲国产另类av| 欧美三级资源在线| 亚洲已满18点击进入久久| 色8久久精品久久久久久蜜| 一区二区三区中文字幕电影 | 美腿丝袜亚洲综合| 欧美大片在线观看| 国产在线麻豆精品观看| 国产片一区二区三区| 国产成人免费视频精品含羞草妖精| 久久久91精品国产一区二区三区| 国产一区在线看| 亚洲国产电影在线观看| 91在线观看成人| 亚洲一区二区三区自拍| 欧美精品粉嫩高潮一区二区| 热久久免费视频| 久久伊人中文字幕| 成人av在线影院| 亚洲欧美日韩综合aⅴ视频| 欧美视频一区在线| 蜜桃av一区二区三区电影| 精品日韩在线观看| 成人激情动漫在线观看| 亚洲乱码精品一二三四区日韩在线| 欧美无砖专区一中文字| 毛片基地黄久久久久久天堂| 久久久99久久| 色视频一区二区| 青青草伊人久久| 欧美激情一区二区三区四区| 99久久综合精品| 日韩在线一区二区| 2020国产成人综合网| 99久久精品情趣| 日本亚洲天堂网| 亚洲国产精品成人久久综合一区| 91视频你懂的| 免费在线观看精品| 中文字幕成人网| 欧美人伦禁忌dvd放荡欲情| 激情五月激情综合网| 亚洲视频一二区| 日韩欧美一区在线| 精品成人一区二区三区| 不卡影院免费观看| 日日噜噜夜夜狠狠视频欧美人| 久久久久久免费网| 欧美中文字幕不卡| 国产一区二区福利| 亚洲一级不卡视频| 久久女同互慰一区二区三区| 91电影在线观看| 国产91综合一区在线观看| 亚洲不卡在线观看| 国产精品色呦呦| 日韩精品一区二区三区视频播放 | 久久精品国产精品亚洲精品| 亚洲色图欧洲色图婷婷| 日韩区在线观看| 在线观看视频91| 国产成人鲁色资源国产91色综| 亚洲v精品v日韩v欧美v专区| 国产精品伦一区二区三级视频| 91精品国产免费| 欧美性一二三区| 成人av资源站| 寂寞少妇一区二区三区| 亚洲国产视频直播| 国产精品激情偷乱一区二区∴| 日韩天堂在线观看| 欧美性受极品xxxx喷水| bt欧美亚洲午夜电影天堂| 美女视频黄久久| 亚洲成人高清在线| 亚洲乱码中文字幕综合| 亚洲国产高清在线观看视频| 欧美大尺度电影在线| 欧美人xxxx| 亚洲综合区在线| 久久精品国产一区二区| 亚洲国产综合人成综合网站| 中文字幕免费观看一区| ww久久中文字幕| 日韩精品资源二区在线| 欧美日韩精品是欧美日韩精品| 337p粉嫩大胆噜噜噜噜噜91av| 欧美三级中文字幕| 91传媒视频在线播放| 97久久久精品综合88久久| 成人中文字幕电影| 国产精品18久久久久久久久| 狠狠色狠狠色综合系列| 麻豆精品新av中文字幕| 免费精品99久久国产综合精品|