Public Member Functions | Public Attributes

vector2 Class Reference

math3d.vector2 2维向量 More...

List of all members.

Public Member Functions

def __abs__
def __add__
def __cmp__
def __init__
def __neg__
def __radd__
def __repr__
def __rsub__
def __str__
def __sub__
def dot
def intrp
def normalize
def set
def __new__

Public Attributes

 is_zero
 bool 只读 是否接近于0
 length
 float 只读 长度
 length_sqr
 float 只读 长度平方
 x
 float 读写 x分量
 y
 float 读写 y分量

Detailed Description

math3d.vector2 2维向量


Constructor & Destructor Documentation

def __init__ (   self )
math3d.vector2 2维向量

__init__(x, y, z)
参数 :
x : float  x分量
y : float  y分量

__init__(v)
参数 :
v : math3d.vector2  被拷贝向量


运算符 :
v1 + v2         向量加法
v1 - v2         向量减法
v1 * v2         向量乘法
v * f           向量乘标量(float或int)
v1 / v2         向量除法
-v              取负
abs(v)          求长度

Member Function Documentation

def __abs__ (   self )
x.__abs__() <==> abs(x)
def __add__ (   self )
x.__add__(y) <==> x+y
def __cmp__ (   self )
x.__cmp__(y) <==> cmp(x,y)
def __neg__ (   self )
x.__neg__() <==> -x
def __radd__ (   self )
x.__radd__(y) <==> y+x
def __repr__ (   self )
x.__repr__() <==> repr(x)
def __rsub__ (   self )
x.__rsub__(y) <==> y-x
def __str__ (   self )
x.__str__() <==> str(x)
def __sub__ (   self )
x.__sub__(y) <==> x-y
def dot (   self )
计算点积

dot(v)
参数 :
v : math3d.vector  另一个向量
返回值 :
float  点积结果
def intrp (   self )
计算插值:v1 * (1 - u) + v2 * u,结果放到self

intrp(v1, v2, u)
参数 :
v1 : math3d.vector  向量v1
v2 : math3d.vector  向量v2
u : float  系数u
def normalize (   self )
归一化,结果放到self

normalize(f = 1.0)
参数 :
f : float  归一化长度
def set (   self )
设置各分量

set(x, y)
参数 :
x : float  x分量
y : float  y分量
def __new__ (   self )
T.__new__(S, ...) -> a new object with type S, a subtype of T
 All Classes Namespaces Functions Variables Properties