Esempio n. 1
0
File: vector.py Progetto: d11/rts
	def randomVectorOnUnitRadiusXZDisk(self):
		"""
		Returns a position randomly distributed on a disk of unit radius
		on the XZ (Y=0) plane, centered at the origin.  Orientation will be
		random and length will range between 0 and 1
		"""
		v = vec3()
		while 1:
			v.set( ((frandom01()*2) - 1, 0, (frandom01()*2) - 1))
			if (v.length()>=1):
				break
		return v
Esempio n. 2
0
    def randomVectorOnUnitRadiusXZDisk(self):
        """
		Returns a position randomly distributed on a disk of unit radius
		on the XZ (Y=0) plane, centered at the origin.  Orientation will be
		random and length will range between 0 and 1
		"""
        v = vec3()
        while 1:
            v.set(((frandom01() * 2) - 1, 0, (frandom01() * 2) - 1))
            if (v.length() >= 1):
                break
        return v
Esempio n. 3
0
    def RandomVectorInUnitRadiusSphere(self):
        """
		Returns a position randomly distributed inside a sphere of unit radius
		centered at the origin.  Orientation will be random and length will range
		between 0 and 1
		"""
        v = vec3()
        while 1:
            v.set((frandom01() * 2) - 1, (frandom01() * 2) - 1,
                  (frandom01() * 2) - 1)
            if (v.length() >= 1):
                break
        return v
Esempio n. 4
0
File: vector.py Progetto: d11/rts
	def RandomVectorInUnitRadiusSphere(self):
		"""
		Returns a position randomly distributed inside a sphere of unit radius
		centered at the origin.  Orientation will be random and length will range
		between 0 and 1
		"""
		v = vec3()
		while 1:
			v.set (	(frandom01()*2) - 1,
					(frandom01()*2) - 1,
					(frandom01()*2) - 1)
			if (v.length()>=1):
				break
		return v