예제 #1
0
def randspecial1 (num_pts, radius):

	if radius < 0: radius = -radius
	l = randdisc.randdisc (num_pts - 2, 0.4*radius)
	l.append ( (-2*radius, -.55*radius) )
	l.append ( (2*radius, .45*radius) )

	return embaralha.embaralha (l)
예제 #2
0
def randspecial2(num_pts, radius):

    if radius < 0: radius = -radius
    l = randdisc.randdisc(num_pts - 4, 0.9 * radius)
    l.append((-radius, -radius))
    l.append((-radius, radius))
    l.append((radius, -radius))
    l.append((radius, radius))

    return embaralha.embaralha(l)
예제 #3
0
def randspecial2 (num_pts, radius):

	if radius < 0: radius = -radius
	l = randdisc.randdisc (num_pts - 4, 0.9*radius)
	l.append ( (-radius, -radius) )
	l.append ( (-radius, radius) )
	l.append ( (radius, -radius) )
	l.append ( (radius, radius) )

	return embaralha.embaralha (l)
예제 #4
0
def rand_n_vertices (num_pts, num_vertices, radius):
	if radius < 0: radius = -radius
	if radius == 0: radius = 10000

	if num_vertices < 4: num_vertices = 4

	if num_vertices > num_pts:
		num_vertices, num_pts = num_pts, num_vertices
	
	l1 = randdisc.randdisc (num_pts - num_vertices, 0.7*radius)
	l2 = randcirc.randcirc (num_vertices, radius)

	l1.extend (l2)

	return embaralha.embaralha (l1)
예제 #5
0
def rand_n_vertices(num_pts, num_vertices, radius):
    if radius < 0: radius = -radius
    if radius == 0: radius = 10000

    if num_vertices < 4: num_vertices = 4

    if num_vertices > num_pts:
        num_vertices, num_pts = num_pts, num_vertices

    l1 = randdisc.randdisc(num_pts - num_vertices, 0.7 * radius)
    l2 = randcirc.randcirc(num_vertices, radius)

    l1.extend(l2)

    return embaralha.embaralha(l1)
예제 #6
0
import random
import embaralha
import sys
from math import *

RADIUS = 10000

if len(sys.argv) < 2:
    print sys.argv[0], '<num-pts>'
    sys.exit(1)

num_pts = int(sys.argv[1])
if num_pts < 0: num_pts = -num_pts

l = [(0, 0), (-2 * RADIUS, 0), (0, RADIUS)]

delta = (pi * 5. / 40) / int(num_pts - 3)
theta = 35 * pi / 40
for i in range(0, int(num_pts - 3)):

    x = int(RADIUS * cos(theta))
    y = int(RADIUS * sin(theta))

    l.append((x, y))
    theta = theta + delta

l = embaralha.embaralha(l)

for i in l:
    print i[0], i[1]
예제 #7
0
import random
import embaralha
import sys
from math import *

RADIUS = 10000

if len (sys.argv) < 2:
	print sys.argv[0],'<num-pts>'
	sys.exit (1)

num_pts = int (sys.argv[1])
if num_pts < 0: num_pts = - num_pts

l = [(0,0), (-2 * RADIUS, 0), (0, RADIUS)]

delta = (pi*5./40) /int (num_pts - 3)
theta = 35*pi/40
for i in range (0, int (num_pts - 3)):

	x = int (RADIUS * cos (theta))
	y = int (RADIUS * sin (theta))

	l.append ((x,y))
	theta = theta + delta

l = embaralha.embaralha (l)

for i in l:
	print i[0],i[1]