コード例 #1
0
ファイル: vggeometry.py プロジェクト: sveinungf/IsoGeo2D
from matplotlib.gridspec import GridSpec
import matplotlib.pyplot as plt
import numpy as np

from plotting.splineplotter import SplinePlotter
from color import Color
from dataset import Dataset


fig = plt.figure(figsize=[6, 6])
gs = GridSpec(1, 1)
ax = fig.add_subplot(gs[0, 0])

dataset = Dataset(1, 1)
splineInterval = np.array([0.0, 1.0])
s = SplinePlotter(ax, splineInterval)
s.plotGrid(dataset.phi.evaluate, 10, 10, color=Color.DIRECT)

xlim = ax.get_xlim()
ylim = ax.get_ylim()
xextent = xlim[1] - xlim[0]
yextent = ylim[1] - ylim[0]
xmid = xlim[0] + xextent/2.0
ymid = ylim[0] + yextent/2.0

newextent = max(xextent, yextent) * 1.1

ticks = np.linspace(-1.0, 2.0, 13)
ax.set_xticks(ticks)
ax.set_yticks(ticks)
コード例 #2
0
ファイル: vgvoxelboundary.py プロジェクト: sveinungf/IsoGeo2D
ax.xaxis.set_major_locator(plt.NullLocator())  # Removes ticks
ax.yaxis.set_major_locator(plt.NullLocator())

texDimSize = 32
newtonTolerance = 1e-5
dataset = Dataset(1, 1, 1)
splineInterval = np.array([0.0, 1.0])

phi = dataset.phi
rho = dataset.rho
phiPlane = SplinePlane(phi, splineInterval, newtonTolerance)
boundingBox = phiPlane.createBoundingBox()
splineModel = SplineModel(None, phiPlane, rho)
samplingScalars = splineModel.generateScalarMatrix(boundingBox, texDimSize, texDimSize, newtonTolerance)

s = SplinePlotter(ax, splineInterval)
s.plotOutline(phi.evaluate, color=Color.DIRECT, linewidth=2.0)

v = VoxelPlotter(ax)
v.plotScalars(samplingScalars, boundingBox, facecolor=None, edgecolor="k")

size = 0.96
left = -0.56
bottom = 0.01
ax.set_xlim([left, left + size])
ax.set_ylim([bottom, bottom + size])

fig.tight_layout()
plt.savefig("output/vg/voxelboundary.pdf", format="pdf", transparent=True)
コード例 #3
0
ファイル: vgthickthin.py プロジェクト: sveinungf/IsoGeo2D
ax2.xaxis.set_major_locator(plt.NullLocator()) # Removes ticks
ax2.yaxis.set_major_locator(plt.NullLocator())

texDimSize = 16
newtonTolerance = 1e-5
dataset = Dataset(1, 1, 0)
splineInterval = np.array([0.0, 1.0])

phi = dataset.phi
rho = dataset.rho
phiPlane = SplinePlane(phi, splineInterval, newtonTolerance)
boundingBox = phiPlane.createBoundingBox()
splineModel = SplineModel(dataset.tf, phiPlane, rho, 1e-5)
samplingScalars = splineModel.generateScalarMatrix(boundingBox, texDimSize, texDimSize, newtonTolerance)

s = SplinePlotter(ax, splineInterval)
s.plotOutline(phi.evaluate, color=Color.DIRECT, linewidth=2.0)

s2 = SplinePlotter(ax2, splineInterval)
s2.plotOutline(phi.evaluate, color=Color.DIRECT, linewidth=2.0)

v = VoxelPlotter(ax)
v.plotScalars(samplingScalars, boundingBox, facecolor=None, edgecolor='k')

v2 = VoxelPlotter(ax2)
v2.plotScalars(samplingScalars, boundingBox, facecolor=None, edgecolor='k')

scalarTexture = Texture2D(samplingScalars)
voxelModel = VoxelModel(dataset.tf, scalarTexture, boundingBox)
baModel = BoundaryAccurateModel(dataset.tf, splineModel, voxelModel)
tbaModel = ThickBoundaryAccurateModel(dataset.tf, splineModel, voxelModel)
コード例 #4
0
ファイル: vgvoxelizing.py プロジェクト: sveinungf/IsoGeo2D
fig2 = plt.figure(figsize=[6, 6])
gs2 = GridSpec(1, 1)
ax2 = fig2.add_subplot(gs[0, 0])

texDimSize = 8
newtonTolerance = 1e-5
dataset = Dataset(1, 1, 1)
splineInterval = np.array([0.0, 1.0])

phi = dataset.phi
rho = dataset.rho
phiPlane = SplinePlane(phi, splineInterval, newtonTolerance)
boundingBox = phiPlane.createBoundingBox()
splineModel = SplineModel(None, phiPlane, rho)

s = SplinePlotter(ax, splineInterval)
s.pointMarker = 'o'
s.pointColor = Color.POINT
s.rayColor = 'k'

p = ParamPlotter(ax2, splineInterval)
p.gridColor = Color.DIRECT

s.plotGrid(phi.evaluate, 10, 10, color=Color.DIRECT)
p.plotGrid(10, 10)
s.plotBoundingBox(boundingBox, edgecolor=Color.BOUNDINGBOX)

p.pointMarker = None
p.pointColor = 'k'
p.connectPoints = True
splineModel.generateScalarMatrix(boundingBox, 1000, texDimSize, newtonTolerance, paramPlotter=p)