-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' of https://github.com/ofloveandhate/bertini_real…
… into develop
- Loading branch information
Showing
6 changed files
with
151 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
# an example of splitting an algebraic surface into pieces separated by singularities, | ||
# and plotting each with a solid color | ||
|
||
import bertini_real as br | ||
import matplotlib.pyplot as plt | ||
|
||
import pathlib | ||
|
||
pkl_files = list(pathlib.Path('.').glob('*.pkl')) | ||
|
||
if not pkl_files: | ||
print('found no pickled data, so trying to gather_and_save') | ||
br.data.gather_and_save() | ||
|
||
|
||
decomposition = br.data.read_most_recent() | ||
print(f'done reading data') | ||
|
||
|
||
pieces = decomposition.separate_into_nonsingular_pieces() | ||
print(f'separated into {len(pieces)} pieces') | ||
|
||
|
||
# make a plotter object | ||
plotter = br.plot.Plotter() | ||
|
||
# set some options | ||
plotter.options.render.vertices = False | ||
plotter.options.render.surface_raw = False | ||
|
||
plotter.options.style.colormap = plt.cm.viridis | ||
|
||
# plot it! | ||
plotter.plot(pieces) | ||
|
||
|
29 changes: 29 additions & 0 deletions
29
python/example/surface_separate_and_save_raw_and_smooth.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import bertini_real as br | ||
import matplotlib.pyplot as plt | ||
|
||
import pathlib | ||
|
||
pkl_files = list(pathlib.Path('.').glob('*.pkl')) | ||
|
||
if not pkl_files: | ||
print('found no pickled data, so trying to gather_and_save') | ||
br.data.gather_and_save() | ||
|
||
|
||
|
||
thickness = 0.01 # this is in object dimensions. | ||
|
||
decomposition = br.data.read_most_recent() | ||
|
||
print(f'done reading data') | ||
|
||
pieces = decomposition.separate_into_nonsingular_pieces() | ||
print(f'separated into {len(pieces)} pieces') | ||
|
||
|
||
|
||
|
||
|
||
for p in pieces: | ||
p.solidify_smooth(distance=thickness) | ||
p.solidify_raw(distance=thickness) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import bertini_real as br | ||
|
||
surface = br.data.read_most_recent() | ||
|
||
pieces = surface.separate_into_nonsingular_pieces() | ||
|
||
surface.write_piece_data() | ||
|
||
br.surface.copy_all_scad_files_here() | ||
|
||
for p in pieces: | ||
p.export_smooth() | ||
|
||
|
||
br.plot.plot(pieces) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import bertini_real as br | ||
import matplotlib.pyplot as plt | ||
import dill | ||
# br.data.gather_and_save() | ||
|
||
surf = br.data.read_most_recent() | ||
|
||
# fileObject = open('BRdata3.pkl', 'rb') | ||
# surf = dill.load(fileObject) | ||
# fileObject.close() | ||
|
||
surf.write_piece_data() | ||
|
||
pieces = surf.separate_into_nonsingular_pieces() | ||
|
||
|
||
br.surface.copy_all_scad_files_here() | ||
# | ||
# plotter = br.plot.plot(pieces) | ||
|
||
# plotter = br.plot.plot(pieces[0]) | ||
|
||
# surf.export_raw() | ||
# surf.export_smooth() | ||
|
||
for p in pieces: | ||
# p.export_smooth() | ||
p.solidify_smooth(0.02) | ||
|
||
print(p.point_singularities() ) | ||
# p.solidify_raw(0.02) | ||
|
||
|
||
|
||
plotter = br.plot.Plotter() | ||
plotter.options.render.vertices = False | ||
plotter.options.render.surface_raw = False | ||
|
||
plotter.options.style.colormap = plt.cm.nipy_spectral | ||
|
||
# plotter.plot(decomposition) | ||
plotter.plot(pieces) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import bertini_real as br | ||
import matplotlib.pyplot as plt | ||
import dill | ||
|
||
def plot_pieces(pieces): | ||
plotter = br.plot.Plotter() | ||
plotter.options.render.vertices = False | ||
plotter.options.render.surface_raw = False | ||
|
||
plotter.options.style.colormap = plt.cm.nipy_spectral | ||
|
||
plotter.plot(pieces) | ||
|
||
|
||
br.data.gather_and_save() | ||
|
||
surf = br.data.read_most_recent() | ||
surf.write_piece_data() | ||
pieces = surf.separate_into_nonsingular_pieces() | ||
br.surface.copy_all_scad_files_here() | ||
|
||
for p in pieces: | ||
p.export_smooth() | ||
|
||
plot_pieces(pieces) | ||
|