Python math.fmod() Examples
The following are 30
code examples of math.fmod().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
math
, or try the search function
.
Example #1
Source File: rex.py From rex-gym with Apache License 2.0 | 6 votes |
def MapToMinusPiToPi(angles): """Maps a list of angles to [-pi, pi]. Args: angles: A list of angles in rad. Returns: A list of angle mapped to [-pi, pi]. """ mapped_angles = copy.deepcopy(angles) for i in range(len(angles)): mapped_angles[i] = math.fmod(angles[i], TWO_PI) if mapped_angles[i] >= math.pi: mapped_angles[i] -= TWO_PI elif mapped_angles[i] < -math.pi: mapped_angles[i] += TWO_PI return mapped_angles
Example #2
Source File: test_math.py From oss-ftp with MIT License | 6 votes |
def testFmod(self): self.assertRaises(TypeError, math.fmod) self.ftest('fmod(10,1)', math.fmod(10,1), 0) self.ftest('fmod(10,0.5)', math.fmod(10,0.5), 0) self.ftest('fmod(10,1.5)', math.fmod(10,1.5), 1) self.ftest('fmod(-10,1)', math.fmod(-10,1), 0) self.ftest('fmod(-10,0.5)', math.fmod(-10,0.5), 0) self.ftest('fmod(-10,1.5)', math.fmod(-10,1.5), -1) self.assertTrue(math.isnan(math.fmod(NAN, 1.))) self.assertTrue(math.isnan(math.fmod(1., NAN))) self.assertTrue(math.isnan(math.fmod(NAN, NAN))) self.assertRaises(ValueError, math.fmod, 1., 0.) self.assertRaises(ValueError, math.fmod, INF, 1.) self.assertRaises(ValueError, math.fmod, NINF, 1.) self.assertRaises(ValueError, math.fmod, INF, 0.) self.assertEqual(math.fmod(3.0, INF), 3.0) self.assertEqual(math.fmod(-3.0, INF), -3.0) self.assertEqual(math.fmod(3.0, NINF), 3.0) self.assertEqual(math.fmod(-3.0, NINF), -3.0) self.assertEqual(math.fmod(0.0, 3.0), 0.0) self.assertEqual(math.fmod(0.0, NINF), 0.0)
Example #3
Source File: schwefel.py From NiaPy with MIT License | 6 votes |
def function(self): r"""Return benchmark evaluation function. Returns: Callable[[int, Union[int, float, List[int, float], numpy.ndarray]], float]: Fitness function """ def g(z, D): if z > 500: return (500 - fmod(z, 500)) * sin(sqrt(fabs(500 - fmod(z, 500)))) - (z - 500) ** 2 / (10000 * D) elif z < -500: return (fmod(z, 500) - 500) * sin(sqrt(fabs(fmod(z, 500) - 500))) + (z - 500) ** 2 / (10000 * D) return z * sin(fabs(z) ** (1 / 2)) def h(x, D): return g(x + 420.9687462275036, D) def f(D, sol): r"""Fitness function. Args: D (int): Dimensionality of the problem sol (Union[int, float, List[int, float], numpy.ndarray]): Solution to check. Returns: float: Fitness value for the solution. """ val = 0.0 for i in range(D): val += h(sol[i], D) return 418.9829 * D - val return f
Example #4
Source File: test_math.py From ironpython2 with Apache License 2.0 | 6 votes |
def testFmod(self): self.assertRaises(TypeError, math.fmod) self.ftest('fmod(10,1)', math.fmod(10,1), 0) self.ftest('fmod(10,0.5)', math.fmod(10,0.5), 0) self.ftest('fmod(10,1.5)', math.fmod(10,1.5), 1) self.ftest('fmod(-10,1)', math.fmod(-10,1), 0) self.ftest('fmod(-10,0.5)', math.fmod(-10,0.5), 0) self.ftest('fmod(-10,1.5)', math.fmod(-10,1.5), -1) self.assertTrue(math.isnan(math.fmod(NAN, 1.))) self.assertTrue(math.isnan(math.fmod(1., NAN))) self.assertTrue(math.isnan(math.fmod(NAN, NAN))) self.assertRaises(ValueError, math.fmod, 1., 0.) self.assertRaises(ValueError, math.fmod, INF, 1.) self.assertRaises(ValueError, math.fmod, NINF, 1.) self.assertRaises(ValueError, math.fmod, INF, 0.) self.assertEqual(math.fmod(3.0, INF), 3.0) self.assertEqual(math.fmod(-3.0, INF), -3.0) self.assertEqual(math.fmod(3.0, NINF), 3.0) self.assertEqual(math.fmod(-3.0, NINF), -3.0) self.assertEqual(math.fmod(0.0, 3.0), 0.0) self.assertEqual(math.fmod(0.0, NINF), 0.0)
Example #5
Source File: test_math.py From BinderFilter with MIT License | 6 votes |
def testFmod(self): self.assertRaises(TypeError, math.fmod) self.ftest('fmod(10,1)', math.fmod(10,1), 0) self.ftest('fmod(10,0.5)', math.fmod(10,0.5), 0) self.ftest('fmod(10,1.5)', math.fmod(10,1.5), 1) self.ftest('fmod(-10,1)', math.fmod(-10,1), 0) self.ftest('fmod(-10,0.5)', math.fmod(-10,0.5), 0) self.ftest('fmod(-10,1.5)', math.fmod(-10,1.5), -1) self.assertTrue(math.isnan(math.fmod(NAN, 1.))) self.assertTrue(math.isnan(math.fmod(1., NAN))) self.assertTrue(math.isnan(math.fmod(NAN, NAN))) self.assertRaises(ValueError, math.fmod, 1., 0.) self.assertRaises(ValueError, math.fmod, INF, 1.) self.assertRaises(ValueError, math.fmod, NINF, 1.) self.assertRaises(ValueError, math.fmod, INF, 0.) self.assertEqual(math.fmod(3.0, INF), 3.0) self.assertEqual(math.fmod(-3.0, INF), -3.0) self.assertEqual(math.fmod(3.0, NINF), 3.0) self.assertEqual(math.fmod(-3.0, NINF), -3.0) self.assertEqual(math.fmod(0.0, 3.0), 0.0) self.assertEqual(math.fmod(0.0, NINF), 0.0)
Example #6
Source File: sphere.py From s2sphere with MIT License | 6 votes |
def advance_wrap(self, steps): assert self.is_valid() if steps == 0: return self step_shift = 2 * (self.__class__.MAX_LEVEL - self.level()) + 1 if steps < 0: min_steps = -(self.id() >> step_shift) if steps < min_steps: step_wrap = self.__class__.WRAP_OFFSET >> step_shift # cannot use steps %= step_wrap as Python % different to C++ steps = int(math.fmod(steps, step_wrap)) if steps < min_steps: steps += step_wrap else: max_steps = (self.__class__.WRAP_OFFSET - self.id()) >> step_shift if steps > max_steps: step_wrap = self.__class__.WRAP_OFFSET >> step_shift # cannot use steps %= step_wrap as Python % different to C++ steps = int(math.fmod(steps, step_wrap)) if steps > max_steps: steps -= step_wrap return self.__class__(self.id() + (steps << step_shift))
Example #7
Source File: minitaur.py From soccer-matlab with BSD 2-Clause "Simplified" License | 6 votes |
def MapToMinusPiToPi(angles): """Maps a list of angles to [-pi, pi]. Args: angles: A list of angles in rad. Returns: A list of angle mapped to [-pi, pi]. """ mapped_angles = copy.deepcopy(angles) for i in range(len(angles)): mapped_angles[i] = math.fmod(angles[i], TWO_PI) if mapped_angles[i] >= math.pi: mapped_angles[i] -= TWO_PI elif mapped_angles[i] < -math.pi: mapped_angles[i] += TWO_PI return mapped_angles
Example #8
Source File: yap_tools.py From yap with Apache License 2.0 | 6 votes |
def split_array(totnum,nprocs,lpp,myrank): """ Returns the indices of the chunk(of the input file) to be split based on the rank of the processor.""" totnum = totnum/lpp n2=int(math.floor(totnum/nprocs)) remain=int(math.fmod(totnum,nprocs)) if (myrank < remain) : n1=n2+1 ib1=(myrank)*n1 ie1=ib1+(n1-1) else : n1=n2 ib1=(myrank)*n1+remain ie1=ib1+n1-1 ib=ib1*lpp ie=((ie1+1)*lpp)-1 ret=[] ret.append(ib) ret.append(ie) return ret
Example #9
Source File: yap_tools.py From yap with Apache License 2.0 | 6 votes |
def split_array(totnum,nprocs,lpp,myrank): """ Determines how the data must be split based on available resources. """ totnum = totnum/lpp n2=int(math.floor(totnum/nprocs)) remain=int(math.fmod(totnum,nprocs)) if (myrank < remain) : n1=n2+1 ib1=(myrank)*n1 ie1=ib1+(n1-1) else : n1=n2 ib1=(myrank)*n1+remain ie1=ib1+n1-1 ib=ib1*lpp ie=((ie1+1)*lpp)-1 ret=[] ret.append(ib) ret.append(ie) return ret
Example #10
Source File: image_ops_test.py From deep_image_model with Apache License 2.0 | 6 votes |
def _adjustHueNp(self, x_np, delta_h): self.assertEqual(x_np.shape[-1], 3) x_v = x_np.reshape([-1, 3]) y_v = np.ndarray(x_v.shape, dtype=x_v.dtype) channel_count = x_v.shape[0] for i in xrange(channel_count): r = x_v[i][0] g = x_v[i][1] b = x_v[i][2] h, s, v = colorsys.rgb_to_hsv(r, g, b) h += delta_h h = math.fmod(h + 10.0, 1.0) r, g, b = colorsys.hsv_to_rgb(h, s, v) y_v[i][0] = r y_v[i][1] = g y_v[i][2] = b return y_v.reshape(x_np.shape)
Example #11
Source File: test_math.py From Fluid-Designer with GNU General Public License v3.0 | 6 votes |
def testFmod(self): self.assertRaises(TypeError, math.fmod) self.ftest('fmod(10, 1)', math.fmod(10, 1), 0.0) self.ftest('fmod(10, 0.5)', math.fmod(10, 0.5), 0.0) self.ftest('fmod(10, 1.5)', math.fmod(10, 1.5), 1.0) self.ftest('fmod(-10, 1)', math.fmod(-10, 1), -0.0) self.ftest('fmod(-10, 0.5)', math.fmod(-10, 0.5), -0.0) self.ftest('fmod(-10, 1.5)', math.fmod(-10, 1.5), -1.0) self.assertTrue(math.isnan(math.fmod(NAN, 1.))) self.assertTrue(math.isnan(math.fmod(1., NAN))) self.assertTrue(math.isnan(math.fmod(NAN, NAN))) self.assertRaises(ValueError, math.fmod, 1., 0.) self.assertRaises(ValueError, math.fmod, INF, 1.) self.assertRaises(ValueError, math.fmod, NINF, 1.) self.assertRaises(ValueError, math.fmod, INF, 0.) self.assertEqual(math.fmod(3.0, INF), 3.0) self.assertEqual(math.fmod(-3.0, INF), -3.0) self.assertEqual(math.fmod(3.0, NINF), 3.0) self.assertEqual(math.fmod(-3.0, NINF), -3.0) self.assertEqual(math.fmod(0.0, 3.0), 0.0) self.assertEqual(math.fmod(0.0, NINF), 0.0)
Example #12
Source File: test_math.py From gcblue with BSD 3-Clause "New" or "Revised" License | 6 votes |
def testFmod(self): self.assertRaises(TypeError, math.fmod) self.ftest('fmod(10,1)', math.fmod(10,1), 0) self.ftest('fmod(10,0.5)', math.fmod(10,0.5), 0) self.ftest('fmod(10,1.5)', math.fmod(10,1.5), 1) self.ftest('fmod(-10,1)', math.fmod(-10,1), 0) self.ftest('fmod(-10,0.5)', math.fmod(-10,0.5), 0) self.ftest('fmod(-10,1.5)', math.fmod(-10,1.5), -1) self.assertTrue(math.isnan(math.fmod(NAN, 1.))) self.assertTrue(math.isnan(math.fmod(1., NAN))) self.assertTrue(math.isnan(math.fmod(NAN, NAN))) self.assertRaises(ValueError, math.fmod, 1., 0.) self.assertRaises(ValueError, math.fmod, INF, 1.) self.assertRaises(ValueError, math.fmod, NINF, 1.) self.assertRaises(ValueError, math.fmod, INF, 0.) self.assertEqual(math.fmod(3.0, INF), 3.0) self.assertEqual(math.fmod(-3.0, INF), -3.0) self.assertEqual(math.fmod(3.0, NINF), 3.0) self.assertEqual(math.fmod(-3.0, NINF), -3.0) self.assertEqual(math.fmod(0.0, 3.0), 0.0) self.assertEqual(math.fmod(0.0, NINF), 0.0)
Example #13
Source File: sphere.py From sphere with MIT License | 6 votes |
def advance_wrap(self, steps): assert self.is_valid() if steps == 0: return self step_shift = 2 * (self.__class__.MAX_LEVEL - self.level()) + 1 if steps < 0: min_steps = -(self.id() >> step_shift) if steps < min_steps: step_wrap = self.__class__.WRAP_OFFSET >> step_shift # cannot use steps %= step_wrap as Python % different to C++ steps = long(math.fmod(steps, step_wrap)) if steps < min_steps: steps += step_wrap else: max_steps = (self.__class__.WRAP_OFFSET - self.id()) >> step_shift if steps > max_steps: step_wrap = self.__class__.WRAP_OFFSET >> step_shift # cannot use steps %= step_wrap as Python % different to C++ steps = long(math.fmod(steps, step_wrap)) if steps > max_steps: steps -= step_wrap return self.__class__(self.id() + (steps << step_shift))
Example #14
Source File: test_math.py From CTFCrackTools-V2 with GNU General Public License v3.0 | 6 votes |
def testFmod(self): self.assertRaises(TypeError, math.fmod) self.ftest('fmod(10,1)', math.fmod(10,1), 0) self.ftest('fmod(10,0.5)', math.fmod(10,0.5), 0) self.ftest('fmod(10,1.5)', math.fmod(10,1.5), 1) self.ftest('fmod(-10,1)', math.fmod(-10,1), 0) self.ftest('fmod(-10,0.5)', math.fmod(-10,0.5), 0) self.ftest('fmod(-10,1.5)', math.fmod(-10,1.5), -1) self.assertTrue(math.isnan(math.fmod(NAN, 1.))) self.assertTrue(math.isnan(math.fmod(1., NAN))) self.assertTrue(math.isnan(math.fmod(NAN, NAN))) self.assertRaises(ValueError, math.fmod, 1., 0.) self.assertRaises(ValueError, math.fmod, INF, 1.) self.assertRaises(ValueError, math.fmod, NINF, 1.) self.assertRaises(ValueError, math.fmod, INF, 0.) self.assertEqual(math.fmod(3.0, INF), 3.0) self.assertEqual(math.fmod(-3.0, INF), -3.0) self.assertEqual(math.fmod(3.0, NINF), 3.0) self.assertEqual(math.fmod(-3.0, NINF), -3.0) self.assertEqual(math.fmod(0.0, 3.0), 0.0) self.assertEqual(math.fmod(0.0, NINF), 0.0)
Example #15
Source File: structure_data.py From lammps_interface with MIT License | 6 votes |
def mod_to_UC(self, num): """ Retrun any fractional coordinate back into the unit cell """ if(hasattr(num,'__iter__')): for i in range(len(num)): if(num[i] < 0.0): num[i] = 1+math.fmod(num[i], 1.0) else: num[i] = math.fmod(num[i], 1.0) return num else: if(num < 0.0): num = math.fmod((num*(-1)), 1.0) else: num = math.fmod(num, 1.0)
Example #16
Source File: geometryHandler.py From DsgTools with GNU General Public License v2.0 | 6 votes |
def getOutOfBoundsAngleInPolygon(self, feat, part, angle, outOfBoundsList, exactAngleMatch=False, angTol=None): angTol = 0.1 if angTol is None else angTol for linearRing in part.asPolygon(): linearRing = self.getClockWiseList(linearRing) nVertex = len(linearRing)-1 def clause(x): return x < angle if not exactAngleMatch \ else not self.isclose(x, angle, abs_tol=angTol) clauseLambda = partial(clause) for i in range(nVertex): if i == 0: vertexAngle = (linearRing[i].azimuth(linearRing[-2]) - linearRing[i].azimuth(linearRing[i+1]) + 360) else: vertexAngle = (linearRing[i].azimuth(linearRing[i-1]) - linearRing[i].azimuth(linearRing[i+1]) + 360) vertexAngle = math.fmod(vertexAngle, 360) if vertexAngle > 180: # if angle calculated is the outter one vertexAngle = 360 - vertexAngle if clauseLambda(vertexAngle): geomDict = {'angle':vertexAngle,'feat_id':feat.id(), 'geom':QgsGeometry.fromPointXY(linearRing[i])} outOfBoundsList.append(geomDict)
Example #17
Source File: geomath.py From qgis-shapetools-plugin with GNU General Public License v2.0 | 6 votes |
def sincosd(x): """Compute sine and cosine of x in degrees.""" r = math.fmod(x, 360) q = Math.nan if Math.isnan(r) else int(math.floor(r / 90 + 0.5)) r -= 90 * q; r = math.radians(r) s = math.sin(r); c = math.cos(r) q = q % 4 if q == 1: s, c = c, -s elif q == 2: s, c = -s, -c elif q == 3: s, c = -c, s # Remove the minus sign on -0.0 except for sin(-0.0). # On Windows 32-bit with python 2.7, math.fmod(-0.0, 360) = +0.0 # (x, c) here fixes this bug. See also Math::sincosd in the C++ library. # AngNormalize has a similar fix. s, c = (x, c) if x == 0 else (0.0+s, 0.0+c) return s, c
Example #18
Source File: __init__.py From finplot with MIT License | 6 votes |
def _round_to_significant(rng, rngmax, x, significant_decimals, significant_eps): is_highres = rng/significant_eps > 1e2 and (rngmax>1e7 or rngmax<1e-2) sd = significant_decimals if is_highres and abs(x)>0: exp10 = floor(np.log10(abs(x))) x = x / (10**exp10) sd = min(5, sd+int(np.log10(rngmax))) fmt = '%%%i.%ife%%i' % (sd, sd) r = fmt % (x, exp10) else: eps = fmod(x, significant_eps) if abs(eps) >= significant_eps/2: # round up eps -= np.sign(eps)*significant_eps x -= eps fmt = '%%%i.%if' % (sd, sd) r = fmt % x return r
Example #19
Source File: test_math.py From Project-New-Reign---Nemesis-Main with GNU General Public License v3.0 | 6 votes |
def testFmod(self): self.assertRaises(TypeError, math.fmod) self.ftest('fmod(10, 1)', math.fmod(10, 1), 0.0) self.ftest('fmod(10, 0.5)', math.fmod(10, 0.5), 0.0) self.ftest('fmod(10, 1.5)', math.fmod(10, 1.5), 1.0) self.ftest('fmod(-10, 1)', math.fmod(-10, 1), -0.0) self.ftest('fmod(-10, 0.5)', math.fmod(-10, 0.5), -0.0) self.ftest('fmod(-10, 1.5)', math.fmod(-10, 1.5), -1.0) self.assertTrue(math.isnan(math.fmod(NAN, 1.))) self.assertTrue(math.isnan(math.fmod(1., NAN))) self.assertTrue(math.isnan(math.fmod(NAN, NAN))) self.assertRaises(ValueError, math.fmod, 1., 0.) self.assertRaises(ValueError, math.fmod, INF, 1.) self.assertRaises(ValueError, math.fmod, NINF, 1.) self.assertRaises(ValueError, math.fmod, INF, 0.) self.assertEqual(math.fmod(3.0, INF), 3.0) self.assertEqual(math.fmod(-3.0, INF), -3.0) self.assertEqual(math.fmod(3.0, NINF), 3.0) self.assertEqual(math.fmod(-3.0, NINF), -3.0) self.assertEqual(math.fmod(0.0, 3.0), 0.0) self.assertEqual(math.fmod(0.0, NINF), 0.0)
Example #20
Source File: effects.py From demosys-py with ISC License | 6 votes |
def draw(self, time, frametime, target): self.ctx.enable_only(moderngl.DEPTH_TEST) m_proj = self.create_projection(near=0.1, far=800.0) m_mv = self.create_transformation(translation=(0.0, -20.0, -200.0)) m_mv = matrix44.multiply(m_mv, self.sys_camera.view_matrix) self.ctx.patch_vertices = 3 self.ctx.wireframe = True if math.fmod(time, 5) < 2.5 else False self.heightmap.use(location=0) self.heights.value = 0 self.proj_matrix.write(m_proj.astype('f4').tobytes()) self.mv_matrix.write(m_mv.astype('f4').tobytes()) self.program['TessLevelInner'].value = self.tess_level self.program['TessLevelOuter'].value = self.tess_level self.terrain.render(self.program, mode=moderngl.PATCHES)
Example #21
Source File: bulge.py From ezdxf with MIT License | 6 votes |
def arc_to_bulge(center: 'Vertex', start_angle: float, end_angle: float, radius: float) -> Tuple['Vec2', 'Vec2', float]: """ Returns bulge parameters from arc parameters. Args: center: circle center point as :class:`Vec2` compatible object start_angle: start angle in radians end_angle: end angle in radians radius: circle radius Returns: tuple: (start_point, end_point, bulge) """ start_point = polar(center, start_angle, radius) end_point = polar(center, end_angle, radius) pi2 = math.pi * 2 a = math.fmod((pi2 + (end_angle - start_angle)), pi2) / 4. bulge = math.sin(a) / math.cos(a) return start_point, end_point, bulge
Example #22
Source File: test_math.py From ironpython3 with Apache License 2.0 | 6 votes |
def testFmod(self): self.assertRaises(TypeError, math.fmod) self.ftest('fmod(10, 1)', math.fmod(10, 1), 0.0) self.ftest('fmod(10, 0.5)', math.fmod(10, 0.5), 0.0) self.ftest('fmod(10, 1.5)', math.fmod(10, 1.5), 1.0) self.ftest('fmod(-10, 1)', math.fmod(-10, 1), -0.0) self.ftest('fmod(-10, 0.5)', math.fmod(-10, 0.5), -0.0) self.ftest('fmod(-10, 1.5)', math.fmod(-10, 1.5), -1.0) self.assertTrue(math.isnan(math.fmod(NAN, 1.))) self.assertTrue(math.isnan(math.fmod(1., NAN))) self.assertTrue(math.isnan(math.fmod(NAN, NAN))) self.assertRaises(ValueError, math.fmod, 1., 0.) self.assertRaises(ValueError, math.fmod, INF, 1.) self.assertRaises(ValueError, math.fmod, NINF, 1.) self.assertRaises(ValueError, math.fmod, INF, 0.) self.assertEqual(math.fmod(3.0, INF), 3.0) self.assertEqual(math.fmod(-3.0, INF), -3.0) self.assertEqual(math.fmod(3.0, NINF), 3.0) self.assertEqual(math.fmod(-3.0, NINF), -3.0) self.assertEqual(math.fmod(0.0, 3.0), 0.0) self.assertEqual(math.fmod(0.0, NINF), 0.0)
Example #23
Source File: perlin.py From Fegaria-Remastered with MIT License | 5 votes |
def noise3(self, x, y, z, repeat, base=0.0): """Tileable 3D noise. repeat specifies the integer interval in each dimension when the noise pattern repeats. base allows a different texture to be generated for the same repeat interval. """ i = int(fmod(floor(x), repeat)) j = int(fmod(floor(y), repeat)) k = int(fmod(floor(z), repeat)) ii = (i + 1) % repeat jj = (j + 1) % repeat kk = (k + 1) % repeat if base: i += base; j += base; k += base ii += base; jj += base; kk += base x -= floor(x); y -= floor(y); z -= floor(z) fx = x**3 * (x * (x * 6 - 15) + 10) fy = y**3 * (y * (y * 6 - 15) + 10) fz = z**3 * (z * (z * 6 - 15) + 10) perm = self.permutation A = perm[i] AA = perm[A + j] AB = perm[A + jj] B = perm[ii] BA = perm[B + j] BB = perm[B + jj] return lerp(fz, lerp(fy, lerp(fx, grad3(perm[AA + k], x, y, z), grad3(perm[BA + k], x - 1, y, z)), lerp(fx, grad3(perm[AB + k], x, y - 1, z), grad3(perm[BB + k], x - 1, y - 1, z))), lerp(fy, lerp(fx, grad3(perm[AA + kk], x, y, z - 1), grad3(perm[BA + kk], x - 1, y, z - 1)), lerp(fx, grad3(perm[AB + kk], x, y - 1, z - 1), grad3(perm[BB + kk], x - 1, y - 1, z - 1))))
Example #24
Source File: effects.py From demosys-py with ISC License | 5 votes |
def draw(self, time, frametime, target): self.renderer.draw( (0.05, math.fmod(time, 75.0) / 5.0), size=0.75, )
Example #25
Source File: models.py From Dallinger with MIT License | 5 votes |
def _func(self, x): return 75 if (math.fmod(x, 50) <= 25) else 25
Example #26
Source File: effects.py From demosys-py with ISC License | 5 votes |
def draw(self, time, frametime, target): self.writer.draw( (0.05, 0.01 - math.fmod(time, 75.0) / 5.0), size=0.05, )
Example #27
Source File: slam.py From slam with Apache License 2.0 | 5 votes |
def boundAngle(phi): from math import fmod,pi #Bound angle to [-pi,pi] if (phi >= 0): phi = fmod(phi,2*pi); else: phi = fmod(phi,-2*pi) if (phi > pi): phi -= 2*pi if (phi < -pi): phi += 2*pi return phi #Compute the weighted orientation of two angles
Example #28
Source File: slam.py From slam with Apache License 2.0 | 5 votes |
def boundAngle(self,phi): from math import fmod,pi #Bound angle to [-pi,pi] if (phi >= 0): phi = fmod(phi,2*pi); else: phi = fmod(phi,-2*pi) if (phi > pi): phi -= 2*pi if (phi < -pi): phi += 2*pi return phi
Example #29
Source File: instanceAlongCurve.py From instanceAlongCurve with MIT License | 5 votes |
def getRampValueAtNormalizedPosition(self, rampValues, v): util = OpenMaya.MScriptUtil() util.createFromDouble(0.0) valuePtr = util.asFloatPtr() position = math.fmod((v * rampValues.rampRepeat) + rampValues.rampOffset, 1.0) rampValues.ramp.getValueAtPosition(position, valuePtr) return util.getFloat(valuePtr)
Example #30
Source File: math.py From sidekick with MIT License | 5 votes |
def fmod(denom, number): """ Return number mod denom keeping the sign of the numerator. (number % denom returns the sign of denominator) Similar to math.fmod, but curried and with the order of arguments flipped. """ return _math.fmod(number, denom)