Skip to content

Instantly share code, notes, and snippets.

@quietsamurai98
Created September 30, 2020 23:41
Show Gist options
  • Save quietsamurai98/cfd70a9e08b02a44df749e3072ffa77c to your computer and use it in GitHub Desktop.
Save quietsamurai98/cfd70a9e08b02a44df749e3072ffa77c to your computer and use it in GitHub Desktop.
3D Wireframe
def tick(args)
unless args.state.model
args.state.model = Object3D.new('data/lowpoly_teapot.off')
args.state.model.fast_3x3_transform!(rotate3D(0.2, 0.0, 0.0))
args.state.spin_mtx = rotate3D(0.00, 0.00, 0.01)
args.outputs.static_lines << args.state.model.edges
end
args.state.model.fast_3x3_transform!(args.state.spin_mtx)
end
def mtx_dot(a, b)
js = (0...b[0].length)
ks = (0...b.length)
(0...a.length).map do |i|
js.map do |j|
sum = 0
ks.each { |k| sum += a[i][k] * b[k][j] }
sum
end
end
end
def rotate3D(theta_x = 0.1, theta_y = 0.1, theta_z = 0.1)
c_x, s_x = Math.cos(theta_x), Math.sin(theta_x)
c_y, s_y = Math.cos(theta_y), Math.sin(theta_y)
c_z, s_z = Math.cos(theta_z), Math.sin(theta_z)
rot_x = [[1, 0, 0], [0, c_x, -s_x], [0, s_x, c_x]]
rot_y = [[c_y, 0, s_y], [0, 1, 0], [-s_y, 0, c_y]]
rot_z = [[c_z, -s_z, 0], [s_z, c_z, 0], [0, 0, 1]]
mtx_dot(mtx_dot(rot_x, rot_y), rot_z)
end
class Vertex
attr_accessor :x, :y, :z
attr_accessor :id
def initialize(data, id)
@x = data[0].to_f
@y = data[1].to_f
@z = data[2].to_f
@id = id
end
def fast_3x3_transform!(mtx)
@x, @y, @z = mtx[0][0] * @x + mtx[0][1] * @y + mtx[0][2] * @z, mtx[1][0] * @x + mtx[1][1] * @y + mtx[1][2] * @z, mtx[2][0] * @x + mtx[2][1] * @y + mtx[2][2] * @z
end
def col_vector
[@x, @y, @z].transpose
end
def set_col_vector(col)
@x = col[0][0]
@y = col[1][0]
@z = col[2][0]
end
end
class Face
attr_reader :verts, :edges
def initialize(data, verts)
vert_count = data[0].to_i
vert_ids = data[1, vert_count].map(&:to_i)
@verts = vert_ids.map { |i| verts[i] }
@edges = (0...vert_count).map { |i| Edge.new(verts[vert_ids[i - 1]], verts[vert_ids[i]]) }.rotate(1)
end
end
class Edge
attr_accessor :a, :r, :g, :b
attr_reader :point_a, :point_b
def initialize(point_a, point_b)
@point_a, @point_b = point_a, point_b
@a = 255
@r = @g = @b = 0
end
def sorted
@point_a.id < @point_b.id ? self : Edge.new(@point_b, @point_a)
end
def x
@point_a.x * 300 + 640
end
def y
@point_a.z * 300 + 360
end
def x2
@point_b.x * 300 + 640
end
def y2
@point_b.z * 300 + 360
end
def primitive_marker
:line
end
end
class Object3D
attr_reader :vert_count, :face_count, :edge_count, :verts, :faces, :edges
def initialize(path = 'data/lowpoly_teapot.off')
@vert_count = @face_count = @edge_count = 0
@verts = []
@faces = []
@edges = []
_init_from_file(path)
end
def _init_from_file(path)
file_lines = $gtk.read_file(path).split("\n")
.reject { |line| line.start_with?('#') || line.split(' ').length == 0 } # Strip out simple comments and blank lines
.map { |line| line.split('#')[0] } # Strip out end of line comments
.map { |line| line.split(' ') } # Tokenize by splitting on whitespace
raise "OFF file did not start with OFF." if file_lines.shift != ["OFF"]
raise "<NVertices NFaces NEdges> line malformed" if file_lines[0].length != 3
@vert_count, @face_count, @edge_count = file_lines.shift&.map(&:to_i)
raise "Incorrect number of vertices and/or faces (Parsed VFE header: #{@vert_count} #{@face_count} #{@edge_count})" if file_lines.length != @vert_count + @face_count
vert_lines = file_lines[0, @vert_count]
face_lines = file_lines[@vert_count, @face_count]
@verts = vert_lines.map_with_index { |line, id| Vertex.new(line, id) }
@faces = face_lines.map { |line| Face.new(line, @verts) }
@edges = @faces.flat_map(&:edges).uniq do |edge|
sorted = edge.sorted
[sorted.point_a, sorted.point_b]
end
end
def fast_3x3_transform!(mtx)
@verts.each { |vert| vert.fast_3x3_transform!(mtx) }
end
end
OFF
349 274 0
-0.5111590623855591 -0.0000061510199885 -0.1299731433391571
-0.5072528123855591 0.0421819426119328 -0.1416841447353363
-0.5072528123855591 -0.0421942584216595 -0.1416841447353363
-0.5004168748855591 -0.0000061510199885 -0.0426770970225334
-0.4986590743064880 0.0562446415424347 -0.1674491465091705
-0.4986590743064880 -0.0562569573521614 -0.1674491465091705
-0.4916278421878815 -0.0000061510199885 -0.2043561041355133
-0.4900652468204498 0.0421819426119328 -0.1932131350040436
-0.4900652468204498 -0.0421942584216595 -0.1932131350040436
-0.4724090397357941 0.1962438523769379 -0.1299731433391571
-0.4724090397357941 -0.1962561607360840 -0.1299731433391571
-0.4720965325832367 -0.0000061510199885 0.0500199198722839
-0.4624993205070496 0.1920278519392014 -0.0426770970225334
-0.4624993205070496 -0.1920401602983475 -0.0426770970225334
-0.4543914198875427 0.1885778456926346 -0.2043561041355133
-0.4543914198875427 -0.1885901540517807 -0.2043561041355133
-0.4486590325832367 -0.0000061510199885 -0.2592151463031769
-0.4363738298416138 0.1809118390083313 0.0500199198722839
-0.4363738298416138 -0.1809241473674774 0.0500199198722839
-0.4320574402809143 -0.0000061510199885 0.1464709043502808
-0.4147527217864990 0.1717128455638885 -0.2592151463031769
-0.4147527217864990 -0.1717251539230347 -0.2592151463031769
-0.3994380235671997 0.1651968508958817 0.1464709043502808
-0.3994380235671997 -0.1652091592550278 0.1464709043502808
-0.3861590325832367 -0.0000061510199885 -0.3179611265659332
-0.3861590325832367 -0.0000061510199885 0.2450268864631653
-0.3661590516567230 0.3549938201904297 -0.1299731433391571
-0.3661590516567230 -0.3550061583518982 -0.1299731433391571
-0.3585320413112640 0.3473668396472931 -0.0426770970225334
-0.3585320413112640 -0.3473791778087616 -0.0426770970225334
-0.3570970296859741 0.1471808403730392 -0.3179611265659332
-0.3570970296859741 0.1471808403730392 0.2450268864631653
-0.3570970296859741 -0.1471931487321854 -0.3179611265659332
-0.3570970296859741 -0.1471931487321854 0.2450268864631653
-0.3522920310497284 0.3411268293857574 -0.2043561041355133
-0.3522920310497284 -0.3411391675472260 -0.2043561041355133
-0.3384250104427338 0.3272598385810852 0.0500199198722839
-0.3384250104427338 -0.3272721767425537 0.0500199198722839
-0.3217840492725372 0.3106188178062439 -0.2592151463031769
-0.3217840492725372 -0.3106311559677124 -0.2592151463031769
-0.3099970519542694 0.2988318204879761 0.1464709043502808
-0.3099970519542694 -0.2988441586494446 0.1464709043502808
-0.3179188370704651 -0.0000061508276303 0.2936187982559204
-0.2941452860832214 0.1203972548246384 0.2936187982559204
-0.2941452860832214 -0.1204095482826233 0.2936187982559204
-0.2774090468883514 0.2662438452243805 -0.3179611265659332
-0.2774090468883514 0.2662438452243805 0.2450268864631653
-0.2774090468883514 -0.2662561833858490 -0.3179611265659332
-0.2774090468883514 -0.2662561833858490 0.2450268864631653
-0.2289584726095200 0.2177932858467102 0.2936187982559204
-0.2289584726095200 -0.2178055942058563 0.2936187982559204
-0.2074090391397476 0.4612438380718231 -0.1299731433391571
-0.2074090391397476 -0.4612561762332916 -0.1299731433391571
-0.2031930536031723 0.4513338208198547 -0.0426770970225334
-0.2031930536031723 -0.4513461589813232 -0.0426770970225334
-0.1997430473566055 0.4432268440723419 -0.2043561041355133
-0.1997430473566055 -0.4432391822338104 -0.2043561041355133
-0.1920770555734634 0.4252088367938995 0.0500199198722839
-0.1920770555734634 -0.4252211749553680 0.0500199198722839
-0.1828780621290207 0.4035878181457520 -0.2592151463031769
-0.1828780621290207 -0.4036001563072205 -0.2592151463031769
-0.1763620525598526 0.3882728219032288 0.1464709043502808
-0.1763620525598526 -0.3882851600646973 0.1464709043502808
-0.1583470553159714 0.3459308445453644 -0.3179611265659332
-0.1583470553159714 0.3459308445453644 0.2450268864631653
-0.1583470553159714 -0.3459431827068329 -0.3179611265659332
-0.1583470553159714 -0.3459431827068329 0.2450268864631653
-0.1315624564886093 0.2829811275005341 0.2936187982559204
-0.1315624564886093 -0.2829934656620026 0.2936187982559204
-0.1228243261575699 0.0475042462348938 0.3240678310394287
-0.1228243261575699 -0.0475165620446205 0.3240678310394287
-0.0945564880967140 0.0355583541095257 0.4464338123798370
-0.0945564880967140 -0.0355706699192524 0.4464338123798370
-0.0907286405563354 0.0339207798242569 0.4166038334369659
-0.0907286405563354 -0.0339330956339836 0.4166038334369659
-0.0601080395281315 0.0208201780915260 0.3466618061065674
-0.0601080395281315 -0.0208324752748013 0.3466618061065674
-0.0593535155057907 0.0205263253301382 0.3798268437385559
-0.0593535155057907 -0.0205386225134134 0.3798268437385559
-0.0586700886487961 0.1116580665111542 0.3240678310394287
-0.0586700886487961 -0.1116703599691391 0.3240678310394287
-0.0467238873243332 0.0833919122815132 0.4464338123798370
-0.0467238873243332 -0.0834042057394981 0.4464338123798370
-0.0450864061713219 0.0795640796422958 0.4166038334369659
-0.0450864061713219 -0.0795763731002808 0.4166038334369659
-0.0319855958223343 0.0489419959485531 0.3466618061065674
-0.0319855958223343 -0.0489543117582798 0.3466618061065674
-0.0316916219890118 0.0481882058084011 0.3798268437385559
-0.0316916219890118 -0.0482005216181278 0.3798268437385559
-0.0111590474843979 -0.0000061508276303 0.4587238132953644
-0.0111590474843979 0.3067547082901001 0.2936187982559204
-0.0111590493470430 0.3749938309192657 -0.3179611265659332
-0.0111590493470430 0.3749938309192657 0.2450268864631653
-0.0111590493470430 0.4208918213844299 0.1464709043502808
-0.0111590493470430 0.4374938309192657 -0.2592151463031769
-0.0111590493470430 0.4609318375587463 0.0500199198722839
-0.0111590493470430 0.4804628193378448 -0.2043561041355133
-0.0111590493470430 0.4892518222332001 -0.0426770970225334
-0.0111590493470430 0.4999938309192657 -0.1299731433391571
-0.0111590474843979 -0.3067670464515686 0.2936187982559204
-0.0111590493470430 -0.3750061690807343 -0.3179611265659332
-0.0111590493470430 -0.3750061690807343 0.2450268864631653
-0.0111590493470430 -0.4209041595458984 0.1464709043502808
-0.0111590493470430 -0.4375061690807343 -0.2592151463031769
-0.0111590493470430 -0.4609441757202148 0.0500199198722839
-0.0111590493470430 -0.4804751574993134 -0.2043561041355133
-0.0111590493470430 -0.4892641603946686 -0.0426770970225334
-0.0111590493470430 -0.5000061392784119 -0.1299731433391571
0.0093735596165061 0.0481882058084011 0.3798268437385559
0.0093735596165061 -0.0482005216181278 0.3798268437385559
0.0096674999222159 0.0489419959485531 0.3466618061065674
0.0096674999222159 -0.0489543117582798 0.3466618061065674
0.0227683372795582 0.0795640796422958 0.4166038334369659
0.0227683372795582 -0.0795763731002808 0.4166038334369659
0.0244057923555374 0.0833919122815132 0.4464338123798370
0.0244057923555374 -0.0834042057394981 0.4464338123798370
0.0363519936800003 0.1116580665111542 0.3240678310394287
0.0363519936800003 -0.1116703599691391 0.3240678310394287
0.0370353907346725 0.0205263253301382 0.3798268437385559
0.0370353907346725 -0.0205386225134134 0.3798268437385559
0.0377899445593357 0.0208201780915260 0.3466618061065674
0.0377899445593357 -0.0208324752748013 0.3466618061065674
0.0684105455875397 0.0339207798242569 0.4166038334369659
0.0684105455875397 -0.0339330956339836 0.4166038334369659
0.0722383484244347 0.0355583541095257 0.4464338123798370
0.0722383484244347 -0.0355706699192524 0.4464338123798370
0.1005062237381935 0.0475042462348938 0.3240678310394287
0.1005062237381935 -0.0475165620446205 0.3240678310394287
0.1092443689703941 0.2829811275005341 0.2936187982559204
0.1092443689703941 -0.2829934656620026 0.2936187982559204
0.1360279470682144 0.3459308445453644 -0.3179611265659332
0.1360279470682144 0.3459308445453644 0.2450268864631653
0.1360279470682144 -0.3459431827068329 -0.3179611265659332
0.1360279470682144 -0.3459431827068329 0.2450268864631653
0.1540439277887344 0.3882728219032288 0.1464709043502808
0.1540439277887344 -0.3882851600646973 0.1464709043502808
0.1605599671602249 0.4035878181457520 -0.2592151463031769
0.1605599671602249 -0.4036001563072205 -0.2592151463031769
0.1697589308023453 0.4252088367938995 0.0500199198722839
0.1697589308023453 -0.4252211749553680 0.0500199198722839
0.1774249821901321 0.4432268440723419 -0.2043561041355133
0.1774249821901321 -0.4432391822338104 -0.2043561041355133
0.1808749586343765 0.4513338208198547 -0.0426770970225334
0.1808749586343765 -0.4513461589813232 -0.0426770970225334
0.1850909739732742 0.4612438380718231 -0.1299731433391571
0.1850909739732742 -0.4612561762332916 -0.1299731433391571
0.2066403776407242 0.2177932858467102 0.2936187982559204
0.2066403776407242 -0.2178055942058563 0.2936187982559204
0.2550909817218781 0.2662438452243805 -0.3179611265659332
0.2550909817218781 0.2662438452243805 0.2450268864631653
0.2550909817218781 -0.2662561833858490 -0.3179611265659332
0.2550909817218781 -0.2662561833858490 0.2450268864631653
0.2718271911144257 0.1203972548246384 0.2936187982559204
0.2718271911144257 -0.1204095482826233 0.2936187982559204
0.2956008017063141 -0.0000061508276303 0.2936187982559204
0.2876789867877960 0.2988318204879761 0.1464709043502808
0.2876789867877960 -0.2988441586494446 0.1464709043502808
0.2994659841060638 0.3106188178062439 -0.2592151463031769
0.2994659841060638 -0.3106311559677124 -0.2592151463031769
0.3161069452762604 0.3272598385810852 0.0500199198722839
0.3161069452762604 -0.3272721767425537 0.0500199198722839
0.3299739658832550 0.3411268293857574 -0.2043561041355133
0.3299739658832550 -0.3411391675472260 -0.2043561041355133
0.3347779810428619 0.1471808403730392 -0.3179611265659332
0.3347779810428619 0.1471808403730392 0.2450268864631653
0.3347779810428619 -0.1471931487321854 -0.3179611265659332
0.3347779810428619 -0.1471931487321854 0.2450268864631653
0.3362139761447906 0.3473668396472931 -0.0426770970225334
0.3362139761447906 -0.3473791778087616 -0.0426770970225334
0.3438409864902496 0.3549938201904297 -0.1299731433391571
0.3438409864902496 -0.3550061583518982 -0.1299731433391571
0.3638409674167633 -0.0000061510199885 -0.3179611265659332
0.3638409674167633 -0.0000061510199885 0.2450268864631653
0.3771199882030487 0.1651968508958817 0.1464709043502808
0.3771199882030487 -0.1652091592550278 0.1464709043502808
0.3924349844455719 0.1717128455638885 -0.2592151463031769
0.3924349844455719 -0.1717251539230347 -0.2592151463031769
0.4097389876842499 -0.0000061510199885 0.1464709043502808
-0.4302399158477783 -0.0000061510199885 0.1503735780715942
-0.4043172001838684 -0.0000061510199885 0.2060365080833435
-0.4177179932594299 0.0421819426119328 0.1593746840953827
-0.4177179932594299 0.0421819426119328 0.1593746840953827
-0.3998532891273499 0.0421819426119328 0.1977350115776062
-0.4177179932594299 0.0421819426119328 0.1593746840953827
0.4140559732913971 0.1809118390083313 0.0500199198722839
0.4140559732913971 -0.1809241473674774 0.0500199198722839
0.4263409674167633 -0.0000061510199885 -0.2592151463031769
0.4320729672908783 0.1885778456926346 -0.2043561041355133
0.4320729672908783 -0.1885901540517807 -0.2043561041355133
0.4401809871196747 0.1920278519392014 -0.0426770970225334
0.4401809871196747 -0.1920401602983475 -0.0426770970225334
0.4497789442539215 -0.0000061510199885 0.0500199198722839
0.4500909745693207 0.1962438523769379 -0.1299731433391571
0.4500909745693207 -0.1962561607360840 -0.1299731433391571
0.4693099558353424 -0.0000061510199885 -0.2043561041355133
-0.4177179932594299 -0.0421942584216595 0.1593746989965439
0.5337609052658081 -0.0000061510199885 0.0284928679466248
0.5429209470748901 0.0837980508804321 0.0046268701553345
0.5429209470748901 -0.0838103443384171 0.0046268701553345
0.5630608797073364 0.1117328554391861 -0.0478790923953056
0.5630608797073364 -0.1117451488971710 -0.0478790923953056
0.5832009315490723 0.0837980508804321 -0.1003851369023323
0.5832009315490723 -0.0838103443384171 -0.1003851369023323
0.5857108831405640 -0.0000061510199885 0.0948498845100403
0.5923609733581543 -0.0000061510199885 -0.1242511048913002
0.5974309444427490 0.0639785528182983 0.0809308886528015
0.5974309444427490 -0.0639908462762833 0.0809308886528015
0.6142309904098511 -0.0000061510199885 0.1752598881721497
0.6232109069824219 0.0853067561984062 0.0503098964691162
0.6232109069824219 -0.0853190496563911 0.0503098964691162
0.6285109519958496 0.0441589429974556 0.1702079176902771
0.6285109519958496 -0.0441712588071823 0.1702079176902771
0.6490008831024170 0.0639785528182983 0.0196878910064697
0.6490008831024170 -0.0639908462762833 0.0196878910064697
0.6599309444427490 0.0588806420564651 0.1590948700904846
0.6599309444427490 -0.0588929578661919 0.1590948700904846
0.6607209444046021 -0.0000061510199885 0.0057688951492310
0.6638408899307251 -0.0000061510199885 0.2450268864631653
0.6872808933258057 0.0351500436663628 0.2450268864631653
0.6872808933258057 -0.0351623594760895 0.2450268864631653
0.6913509368896484 0.0441589429974556 0.1479818820953369
0.6913509368896484 -0.0441712588071823 0.1479818820953369
0.6950908899307251 -0.0000061510199885 0.2585768699645996
0.7056409120559692 -0.0000061510199885 0.1429299116134644
0.7186509370803833 0.0281188506633043 0.2594498991966248
0.7186509370803833 -0.0281311478465796 0.2594498991966248
0.7388409376144409 0.0468688420951366 0.2450268864631653
0.7388409376144409 -0.0468811579048634 0.2450268864631653
0.7704809904098511 0.0374938435852528 0.2613688707351685
0.7704809904098511 -0.0375061593949795 0.2613688707351685
0.7904009819030762 0.0351500436663628 0.2450268864631653
0.7904009819030762 -0.0351623594760895 0.2450268864631653
0.8138409852981567 -0.0000061510199885 0.2450268864631653
0.8223109245300293 0.0281188506633043 0.2632889151573181
0.8223109245300293 -0.0281311478465796 0.2632889151573181
0.8458709716796875 -0.0000061510199885 0.2641608715057373
-0.5912371873855591 -0.0000061510199885 -0.0792530700564384
-0.5938922762870789 0.0421819426119328 -0.0885121151804924
-0.5938922762870789 -0.0421942584216595 -0.0885121151804924
-0.5997332930564880 0.0562446415424347 -0.1088821366429329
-0.5997332930564880 -0.0562569573521614 -0.1088821366429329
-0.6055743694305420 0.0421819426119328 -0.1292510926723480
-0.6055743694305420 -0.0421942584216595 -0.1292510926723480
-0.6082293391227722 -0.0000061510199885 -0.1385101377964020
-0.6142840385437012 -0.0000061510199885 0.1440138816833496
-0.6225850582122803 0.0421819426119328 0.1516578793525696
-0.6225850582122803 -0.0421942584216595 0.1516578793525696
-0.6408470273017883 0.0562446415424347 0.1684738993644714
-0.6408470273017883 -0.0562569573521614 0.1684738993644714
-0.6455340981483459 -0.0000061510199885 -0.0179120823740959
-0.6531020402908325 0.0421819426119328 -0.0253990814089775
-0.6531020402908325 -0.0421942584216595 -0.0253990814089775
-0.6591080427169800 0.0421819426119328 0.1852899193763733
-0.6591080427169800 -0.0421942584216595 0.1852899193763733
-0.6674090623855591 -0.0000061510199885 0.1929329037666321
-0.6678000688552856 -0.0000061510199885 0.1273438930511475
-0.6697530746459961 0.0562446415424347 -0.0418690964579582
-0.6697530746459961 -0.0562569573521614 -0.0418690964579582
-0.6763930916786194 -0.0000061510199885 0.0436108708381653
-0.6787250638008118 0.0421819426119328 0.1323938965797424
-0.6787250638008118 -0.0421942584216595 0.1323938965797424
-0.6861590743064880 -0.0000061510199885 0.0948808789253235
-0.6864030957221985 0.0421819426119328 -0.0583391115069389
-0.6864030957221985 -0.0421942584216595 -0.0583391115069389
-0.6870440840721130 0.0421819426119328 0.0387129187583923
-0.6870440840721130 -0.0421942584216595 0.0387129187583923
-0.6939710974693298 -0.0000061510199885 -0.0658250972628593
-0.6978780627250671 0.0421819426119328 0.0948808789253235
-0.6978780627250671 -0.0421942584216595 0.0948808789253235
-0.7027610540390015 0.0562446415424347 0.1435049176216125
-0.7027610540390015 -0.0562569573521614 0.1435049176216125
-0.7104750275611877 0.0562446415424347 0.0279368758201599
-0.7104750275611877 -0.0562569573521614 0.0279368758201599
-0.7236590981483459 0.0562446415424347 0.0948808789253235
-0.7236590981483459 -0.0562569573521614 0.0948808789253235
-0.7267960906028748 0.0421819426119328 0.1546149253845215
-0.7267960906028748 -0.0421942584216595 0.1546149253845215
-0.7339070439338684 0.0421819426119328 0.0171598792076111
-0.7339070439338684 -0.0421942584216595 0.0171598792076111
-0.7377210259437561 -0.0000061510199885 0.1596658825874329
-0.7445570826530457 -0.0000061510199885 0.0122618675231934
-0.7494400739669800 0.0421819426119328 0.0948808789253235
-0.7494400739669800 -0.0421942584216595 0.0948808789253235
-0.7611590623855591 -0.0000061510199885 0.0948808789253235
0.4694563150405884 0.0981678813695908 -0.1299731433391571
0.4656345248222351 0.0900518521666527 -0.1506306082010269
0.4596491456031799 0.1200573518872261 -0.0853989869356155
0.4581046700477600 0.1012542173266411 -0.0426770970225334
0.4694563150405884 0.0981678813695908 -0.1299731433391571
0.4581046700477600 0.1012542173266411 -0.0426770970225334
0.4596491456031799 0.1200573518872261 -0.0853989869356155
0.4534673690795898 0.0900413021445274 -0.0202514398843050
0.4694563150405884 0.0981678813695908 -0.1299731433391571
0.4694563150405884 0.0981678813695908 -0.1299731433391571
0.4614420533180237 -0.0000061510199885 0.0118442289531231
0.4656345248222351 0.0900518521666527 -0.1506306082010269
0.4766086041927338 -0.0000061510199885 -0.1765594929456711
0.4581046700477600 0.1012542173266411 -0.0426770970225334
0.4656345248222351 0.0900518521666527 -0.1506306082010269
0.4534673988819122 -0.0900535881519318 -0.0202514324337244
0.4583325386047363 -0.1001125574111938 -0.0426770970225334
0.4581046700477600 0.1012542173266411 -0.0426770970225334
0.4656345248222351 0.0900518521666527 -0.1506306082010269
0.4596489965915680 -0.1200696676969528 -0.0853990539908409
0.4596491456031799 0.1200573518872261 -0.0853989869356155
0.4694473743438721 -0.0982253625988960 -0.1299731433391571
0.4656347334384918 -0.0900641381740570 -0.1506305187940598
0.4596491456031799 0.1200573518872261 -0.0853989869356155
0.4534673690795898 0.0900413021445274 -0.0202514398843050
0.4534673690795898 0.0900413021445274 -0.0202514398843050
0.4534673690795898 0.0900413021445274 -0.0202514398843050
0.4614420533180237 -0.0000061510199885 0.0118442289531231
0.4614420533180237 -0.0000061510199885 0.0118442289531231
0.4614420533180237 -0.0000061510199885 0.0118442289531231
0.4766086041927338 -0.0000061510199885 -0.1765594929456711
0.4766086041927338 -0.0000061510199885 -0.1765594929456711
0.4766086041927338 -0.0000061510199885 -0.1765594929456711
0.4534673988819122 -0.0900535881519318 -0.0202514324337244
0.4534673988819122 -0.0900535881519318 -0.0202514324337244
0.4534673988819122 -0.0900535881519318 -0.0202514324337244
0.4583325386047363 -0.1001125574111938 -0.0426770970225334
0.4583325386047363 -0.1001125574111938 -0.0426770970225334
0.4583325386047363 -0.1001125574111938 -0.0426770970225334
0.4596489965915680 -0.1200696676969528 -0.0853990539908409
0.4596489965915680 -0.1200696676969528 -0.0853990539908409
0.4596489965915680 -0.1200696676969528 -0.0853990539908409
0.4694473743438721 -0.0982253625988960 -0.1299731433391571
0.4694473743438721 -0.0982253625988960 -0.1299731433391571
0.4694473743438721 -0.0982253625988960 -0.1299731433391571
0.4656347334384918 -0.0900641381740570 -0.1506305187940598
0.4656347334384918 -0.0900641381740570 -0.1506305187940598
0.4656347334384918 -0.0900641381740570 -0.1506305187940598
-0.4302399158477783 -0.0000061510199885 0.1503735780715942
-0.4302399158477783 -0.0000061510199885 0.1503735780715942
-0.4177179932594299 -0.0421942584216595 0.1593746989965439
-0.4177179932594299 -0.0421942584216595 0.1593746989965439
-0.3998532891273499 0.0421819426119328 0.1977350115776062
-0.3998532891273499 0.0421819426119328 0.1977350115776062
-0.4059552550315857 0.0562446415424347 0.1786701828241348
-0.4059552550315857 0.0562446415424347 0.1786701828241348
-0.4059552550315857 0.0562446415424347 0.1786701828241348
-0.4043172001838684 -0.0000061510199885 0.2060365080833435
-0.4043172001838684 -0.0000061510199885 0.2060365080833435
-0.3998531997203827 -0.0421942546963692 0.1977350115776062
-0.3998531997203827 -0.0421942546963692 0.1977350115776062
-0.3998531997203827 -0.0421942546963692 0.1977350115776062
-0.4059551954269409 -0.0562569573521614 0.1786701828241348
-0.4059551954269409 -0.0562569573521614 0.1786701828241348
-0.4059551954269409 -0.0562569573521614 0.1786701828241348
4 146 128 131 149
4 128 90 92 131
4 90 67 64 92
4 67 49 46 64
4 49 43 31 46
4 43 42 25 31
4 42 44 33 25
4 44 50 48 33
4 50 68 66 48
4 68 99 101 66
4 99 129 133 101
4 129 147 151 133
4 147 153 166 151
4 153 154 172 166
4 172 164 173 177
4 164 149 155 173
4 149 131 134 155
4 131 92 93 134
4 177 173 184 191
4 173 155 159 184
4 155 134 138 159
4 134 93 95 138
6 191 184 189 287 309 313
4 184 159 167 189
4 159 138 142 167
4 138 95 97 142
4 178 181 245 244
4 189 167 169 192
4 167 142 144 169
4 142 97 98 144
4 92 64 61 93
4 64 46 40 61
4 46 31 22 40
9 31 25 341 337 340 180 333 19 22
4 93 61 57 95
4 61 40 36 57
4 40 22 17 36
4 22 19 11 17
4 95 57 53 97
4 57 36 28 53
4 36 17 12 28
4 17 11 3 12
4 97 53 51 98
4 53 28 26 51
4 28 12 9 26
4 12 3 0 9
9 25 33 23 19 333 335 348 344 341
4 33 48 41 23
4 48 66 62 41
4 66 101 102 62
4 19 23 18 11
4 23 41 37 18
4 41 62 58 37
4 62 102 104 58
4 11 18 13 3
4 18 37 29 13
4 37 58 54 29
4 58 104 106 54
4 3 13 10 0
4 13 29 27 10
4 29 54 52 27
4 54 106 107 52
4 101 133 135 102
4 133 151 156 135
4 151 166 174 156
4 166 172 177 174
4 102 135 139 104
4 135 156 160 139
4 156 174 185 160
4 174 177 191 185
4 104 139 143 106
4 139 160 168 143
4 160 185 190 168
6 185 191 313 318 321 190
4 106 143 145 107
4 143 168 170 145
4 168 190 193 170
5 190 321 325 328 193
4 346 195 246 248
4 192 169 161 187
4 169 144 140 161
4 144 98 96 140
4 194 187 175 186
4 187 161 157 175
4 161 140 136 157
4 140 96 94 136
4 157 148 163 175
4 136 130 148 157
4 94 91 130 136
4 59 63 91 94
4 98 51 55 96
4 51 26 34 55
4 26 9 14 34
4 96 55 59 94
4 55 34 38 59
4 34 14 20 38
4 14 6 16 20
4 38 45 63 59
4 20 30 45 38
4 16 24 30 20
4 21 32 24 16
4 10 27 35 15
4 27 52 56 35
4 52 107 105 56
4 6 15 21 16
4 15 35 39 21
4 35 56 60 39
4 56 105 103 60
4 39 47 32 21
4 60 65 47 39
4 103 100 65 60
4 137 132 100 103
4 107 145 141 105
4 145 170 162 141
4 170 193 188 162
6 193 328 330 296 194 188
4 105 141 137 103
4 141 162 158 137
4 162 188 176 158
4 188 194 186 176
4 158 150 132 137
4 176 165 150 158
4 186 171 165 176
4 244 245 259 255
4 245 247 269 259
4 247 252 275 269
4 252 254 279 275
4 255 259 267 261
4 259 269 273 267
4 269 275 281 273
4 275 279 283 281
4 219 225 229 227
3 89 81 114
5 116 128 146 152 126
4 254 253 276 279
4 253 248 270 276
4 248 246 260 270
4 246 244 255 260
4 279 276 282 283
4 276 270 274 282
4 270 260 268 274
4 260 255 261 268
4 261 267 264 258
4 267 273 271 264
4 273 281 277 271
4 281 283 280 277
4 258 264 250 249
4 264 271 256 250
4 271 277 262 256
4 277 280 266 262
4 249 250 237 236
4 250 256 239 237
4 256 262 241 239
4 262 266 243 241
4 236 237 1 0
4 237 239 4 1
4 239 241 7 4
4 241 243 6 7
4 283 282 278 280
4 282 274 272 278
4 274 268 265 272
4 268 261 258 265
4 280 278 263 266
4 278 272 257 263
4 272 265 251 257
4 265 258 249 251
4 266 263 242 243
4 263 257 240 242
4 257 251 238 240
4 251 249 236 238
4 243 242 8 6
4 242 240 5 8
4 240 238 2 5
4 238 236 0 2
4 195 178 244 246
4 345 346 248 253
4 181 338 247 245
4 196 197 205 203
4 199 201 212 208
4 201 204 216 212
4 203 205 210 207
4 208 205 197 199
4 208 212 220 214
4 212 216 223 220
4 207 210 218 217
4 175 163 171 186
4 220 223 232 230
8 224 228 233 235 234 229 225 222
4 338 182 252 247
4 204 202 213 216
4 202 200 209 213
4 198 196 203 206
4 216 213 221 223
4 213 209 215 221
4 206 209 200 198
4 206 203 207 211
4 223 221 231 232
4 232 235 233 230
4 211 207 217 219
4 226 228 224 218
4 230 233 228 226
4 231 234 235 232
4 227 229 234 231
4 217 222 225 219
4 211 219 227 215
4 152 146 149 164
4 208 214 210 205
4 214 226 218 210
4 206 211 215 209
16 171 163 148 130 91 63 45 30 24 32 47 65 100 132 150 165
3 89 72 71
3 89 82 72
3 89 115 82
4 88 109 111 86
4 81 71 73 83
4 71 72 74 73
4 122 112 108 118
4 113 123 119 109
4 73 74 78 77
4 124 114 112 122
4 87 77 75 85
4 77 78 76 75
3 89 114 124
4 72 82 84 74
4 125 124 122 123
4 74 84 88 78
4 123 122 118 119
4 78 88 86 76
4 119 118 120 121
3 89 125 115
3 124 125 89
4 115 125 123 113
4 114 81 83 112
4 82 115 113 84
4 112 83 87 108
4 109 119 121 111
4 108 87 85 110
3 89 71 81
4 118 108 110 120
4 83 73 77 87
4 75 76 70 69
4 76 86 80 70
4 154 152 164 172
5 79 67 90 128 116
5 99 68 80 117 129
5 147 129 117 127 153
4 121 120 126 127
4 86 111 117 80
5 70 44 42 43 69
5 49 67 79 69 43
4 85 75 69 79
4 110 85 79 116
5 154 153 127 126 152
4 120 110 116 126
5 50 44 70 80 68
4 220 230 226 214
4 215 227 231 221
4 218 224 222 217
4 84 113 109 88
4 111 121 127 117
6 296 285 293 192 187 194
5 323 300 319 198 200
4 311 310 197 196
4 182 342 254 252
4 342 345 253 254
4 314 331 202 204
5 310 289 286 199 197
4 319 311 196 198
5 293 290 287 189 192
4 295 314 204 201
5 286 284 295 201 199
5 331 305 323 200 202
7 10 15 6 8 5 2 0
7 9 0 1 4 7 6 14
@quietsamurai98
Copy link
Author

NOTE: I renamed lowpoly_teapot.off to zzz_lowpoly_teapot.off so the code would show at the top of the gist.
The code assumes there's a file called lowpoly_teapot.off in the data directory.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment