Ejemplo n.º 1
0
__author__ = 'benjamin'

from dc2D import tworesolution_dual_contour
from dcSample import sample_data, sphere_f, doubletorus_f, torus_f

import numpy as np

dimensions = {'xmin': 0.0, 'xmax': 6.0, 'ymin': 2.0, 'ymax': 6.0}
res_fine = 1.0/16.0
res_coarse = res_fine * 8.0
resolutions = {'fine': res_fine,'coarse': res_coarse}

fine_data = sample_data(doubletorus_f, resolutions['fine'], dimensions)
[verts_out_dc, quads_out_dc] = tworesolution_dual_contour(fine_data, resolutions, dimensions)


import matplotlib.pyplot as plt

fig = plt.figure()

for q in quads_out_dc['fine']:
    vtx = verts_out_dc['fine'][q]
    x = vtx[:,0]
    y = vtx[:,1]
    #plt.plot(x, y, 'b')
    #plt.plot(x, y, 'bo')

for q in quads_out_dc['coarse']:
    vtx = verts_out_dc['coarse'][q]
    x = vtx[:,0]
    y = vtx[:,1]
Ejemplo n.º 2
0
from redis.utils import dummy

__author__ = 'benjamin'

from dc2D import dual_contour
from dcSample import sample_data, sphere_f, doubletorus_f, torus_f
from dcPlotting import plot_edges, plot_vertices, plot_non_manifold_vertices
from dcManifolds import detectManifolds2d

dimensions = {'xmin': 0.0, 'xmax': 8.0, 'ymin': 0.0, 'ymax': 8.0}
resolution = 1.0/4.0

data = sample_data(doubletorus_f, resolution, dimensions)
[dc_verts, dc_edges] = dual_contour(data, resolution, dimensions)
non_manifold_verts = detectManifolds2d(dc_edges)

import matplotlib.pyplot as plt

fig = plt.figure()

#plot_vertices(dc_verts)
plot_edges(dc_edges, dc_verts)
plot_non_manifold_vertices(dc_verts, non_manifold_verts)

plt.xlim(xmin = 0, xmax = 8)
plt.ylim(ymin = 0, ymax = 8)
plt.show()