opengeometry 0.0.1 → 0.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.js CHANGED
@@ -822,6 +822,141 @@ typeof FinalizationRegistry === 'undefined' ? {
822
822
  } : new FinalizationRegistry(ptr => wasm.__wbg_colorrgb_free(ptr >>> 0, 1));
823
823
  typeof FinalizationRegistry === 'undefined' ? {
824
824
  } : new FinalizationRegistry(ptr => wasm.__wbg_matrix3d_free(ptr >>> 0, 1));
825
+ const OGCylinderFinalization = typeof FinalizationRegistry === 'undefined' ? {
826
+ register: () => {},
827
+ unregister: () => {}
828
+ } : new FinalizationRegistry(ptr => wasm.__wbg_ogcylinder_free(ptr >>> 0, 1));
829
+ /**
830
+ */
831
+ class OGCylinder {
832
+ __destroy_into_raw() {
833
+ const ptr = this.__wbg_ptr;
834
+ this.__wbg_ptr = 0;
835
+ OGCylinderFinalization.unregister(this);
836
+ return ptr;
837
+ }
838
+ free() {
839
+ const ptr = this.__destroy_into_raw();
840
+ wasm.__wbg_ogcylinder_free(ptr, 0);
841
+ }
842
+ /**
843
+ * @param {string} id
844
+ */
845
+ set id(id) {
846
+ const ptr0 = passStringToWasm0(id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
847
+ const len0 = WASM_VECTOR_LEN;
848
+ wasm.ogcylinder_set_id(this.__wbg_ptr, ptr0, len0);
849
+ }
850
+ /**
851
+ * @returns {string}
852
+ */
853
+ get id() {
854
+ let deferred1_0;
855
+ let deferred1_1;
856
+ try {
857
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
858
+ wasm.ogcylinder_id(retptr, this.__wbg_ptr);
859
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
860
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
861
+ deferred1_0 = r0;
862
+ deferred1_1 = r1;
863
+ return getStringFromWasm0(r0, r1);
864
+ } finally {
865
+ wasm.__wbindgen_add_to_stack_pointer(16);
866
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
867
+ }
868
+ }
869
+ /**
870
+ * @param {string} id
871
+ */
872
+ constructor(id) {
873
+ const ptr0 = passStringToWasm0(id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
874
+ const len0 = WASM_VECTOR_LEN;
875
+ const ret = wasm.ogcylinder_new(ptr0, len0);
876
+ this.__wbg_ptr = ret >>> 0;
877
+ OGCylinderFinalization.register(this, this.__wbg_ptr, this);
878
+ return this;
879
+ }
880
+ /**
881
+ * @param {Vector3D} center
882
+ * @param {number} radius
883
+ * @param {number} height
884
+ * @param {number} angle
885
+ * @param {number} segments
886
+ */
887
+ set_config(center, radius, height, angle, segments) {
888
+ _assertClass(center, Vector3D);
889
+ var ptr0 = center.__destroy_into_raw();
890
+ wasm.ogcylinder_set_config(this.__wbg_ptr, ptr0, radius, height, angle, segments);
891
+ }
892
+ /**
893
+ */
894
+ generate_geometry() {
895
+ wasm.ogcylinder_generate_geometry(this.__wbg_ptr);
896
+ }
897
+ /**
898
+ * @returns {string}
899
+ */
900
+ get_geometry() {
901
+ let deferred1_0;
902
+ let deferred1_1;
903
+ try {
904
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
905
+ wasm.ogcylinder_get_geometry(retptr, this.__wbg_ptr);
906
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
907
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
908
+ deferred1_0 = r0;
909
+ deferred1_1 = r1;
910
+ return getStringFromWasm0(r0, r1);
911
+ } finally {
912
+ wasm.__wbindgen_add_to_stack_pointer(16);
913
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
914
+ }
915
+ }
916
+ /**
917
+ */
918
+ discard_geometry() {
919
+ wasm.ogcylinder_discard_geometry(this.__wbg_ptr);
920
+ }
921
+ /**
922
+ * @returns {string}
923
+ */
924
+ outline_edges() {
925
+ let deferred1_0;
926
+ let deferred1_1;
927
+ try {
928
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
929
+ wasm.ogcylinder_outline_edges(retptr, this.__wbg_ptr);
930
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
931
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
932
+ deferred1_0 = r0;
933
+ deferred1_1 = r1;
934
+ return getStringFromWasm0(r0, r1);
935
+ } finally {
936
+ wasm.__wbindgen_add_to_stack_pointer(16);
937
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
938
+ }
939
+ }
940
+ /**
941
+ * @returns {string}
942
+ */
943
+ get_brep_dump() {
944
+ let deferred1_0;
945
+ let deferred1_1;
946
+ try {
947
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
948
+ wasm.ogcylinder_get_brep_dump(retptr, this.__wbg_ptr);
949
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
950
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
951
+ deferred1_0 = r0;
952
+ deferred1_1 = r1;
953
+ return getStringFromWasm0(r0, r1);
954
+ } finally {
955
+ wasm.__wbindgen_add_to_stack_pointer(16);
956
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
957
+ }
958
+ }
959
+ }
825
960
  const OGPolyLineFinalization = typeof FinalizationRegistry === 'undefined' ? {
826
961
  register: () => {},
827
962
  unregister: () => {}
@@ -920,12 +1055,415 @@ class OGPolyLine {
920
1055
  /**
921
1056
  * @returns {string}
922
1057
  */
923
- get_points() {
1058
+ get_points() {
1059
+ let deferred1_0;
1060
+ let deferred1_1;
1061
+ try {
1062
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1063
+ wasm.ogpolyline_get_points(retptr, this.__wbg_ptr);
1064
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1065
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1066
+ deferred1_0 = r0;
1067
+ deferred1_1 = r1;
1068
+ return getStringFromWasm0(r0, r1);
1069
+ } finally {
1070
+ wasm.__wbindgen_add_to_stack_pointer(16);
1071
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
1072
+ }
1073
+ }
1074
+ /**
1075
+ * @returns {(Vector3D)[]}
1076
+ */
1077
+ get_raw_points() {
1078
+ try {
1079
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1080
+ wasm.ogpolyline_get_raw_points(retptr, this.__wbg_ptr);
1081
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1082
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1083
+ var v1 = getArrayJsValueFromWasm0(r0, r1).slice();
1084
+ wasm.__wbindgen_free(r0, r1 * 4, 4);
1085
+ return v1;
1086
+ } finally {
1087
+ wasm.__wbindgen_add_to_stack_pointer(16);
1088
+ }
1089
+ }
1090
+ /**
1091
+ * @returns {boolean}
1092
+ */
1093
+ is_closed() {
1094
+ const ret = wasm.ogpolyline_is_closed(this.__wbg_ptr);
1095
+ return ret !== 0;
1096
+ }
1097
+ /**
1098
+ */
1099
+ check_closed_test() {
1100
+ wasm.ogpolyline_check_closed_test(this.__wbg_ptr);
1101
+ }
1102
+ }
1103
+ const OGPolygonFinalization = typeof FinalizationRegistry === 'undefined' ? {
1104
+ register: () => {},
1105
+ unregister: () => {}
1106
+ } : new FinalizationRegistry(ptr => wasm.__wbg_ogpolygon_free(ptr >>> 0, 1));
1107
+ /**
1108
+ */
1109
+ class OGPolygon {
1110
+ static __wrap(ptr) {
1111
+ ptr = ptr >>> 0;
1112
+ const obj = Object.create(OGPolygon.prototype);
1113
+ obj.__wbg_ptr = ptr;
1114
+ OGPolygonFinalization.register(obj, obj.__wbg_ptr, obj);
1115
+ return obj;
1116
+ }
1117
+ __destroy_into_raw() {
1118
+ const ptr = this.__wbg_ptr;
1119
+ this.__wbg_ptr = 0;
1120
+ OGPolygonFinalization.unregister(this);
1121
+ return ptr;
1122
+ }
1123
+ free() {
1124
+ const ptr = this.__destroy_into_raw();
1125
+ wasm.__wbg_ogpolygon_free(ptr, 0);
1126
+ }
1127
+ /**
1128
+ * @returns {boolean}
1129
+ */
1130
+ get extruded() {
1131
+ const ret = wasm.__wbg_get_ogpolygon_extruded(this.__wbg_ptr);
1132
+ return ret !== 0;
1133
+ }
1134
+ /**
1135
+ * @param {boolean} arg0
1136
+ */
1137
+ set extruded(arg0) {
1138
+ wasm.__wbg_set_ogpolygon_extruded(this.__wbg_ptr, arg0);
1139
+ }
1140
+ /**
1141
+ * @returns {number}
1142
+ */
1143
+ get extruded_height() {
1144
+ const ret = wasm.__wbg_get_ogpolygon_extruded_height(this.__wbg_ptr);
1145
+ return ret;
1146
+ }
1147
+ /**
1148
+ * @param {number} arg0
1149
+ */
1150
+ set extruded_height(arg0) {
1151
+ wasm.__wbg_set_ogpolygon_extruded_height(this.__wbg_ptr, arg0);
1152
+ }
1153
+ /**
1154
+ * @returns {boolean}
1155
+ */
1156
+ get is_polygon() {
1157
+ const ret = wasm.__wbg_get_ogpolygon_is_polygon(this.__wbg_ptr);
1158
+ return ret !== 0;
1159
+ }
1160
+ /**
1161
+ * @param {boolean} arg0
1162
+ */
1163
+ set is_polygon(arg0) {
1164
+ wasm.__wbg_set_ogpolygon_is_polygon(this.__wbg_ptr, arg0);
1165
+ }
1166
+ /**
1167
+ * @returns {Vector3D}
1168
+ */
1169
+ get position() {
1170
+ const ret = wasm.__wbg_get_ogpolygon_position(this.__wbg_ptr);
1171
+ return Vector3D.__wrap(ret);
1172
+ }
1173
+ /**
1174
+ * @param {Vector3D} arg0
1175
+ */
1176
+ set position(arg0) {
1177
+ _assertClass(arg0, Vector3D);
1178
+ var ptr0 = arg0.__destroy_into_raw();
1179
+ wasm.__wbg_set_ogpolygon_position(this.__wbg_ptr, ptr0);
1180
+ }
1181
+ /**
1182
+ * @returns {Vector3D}
1183
+ */
1184
+ get rotation() {
1185
+ const ret = wasm.__wbg_get_ogpolygon_rotation(this.__wbg_ptr);
1186
+ return Vector3D.__wrap(ret);
1187
+ }
1188
+ /**
1189
+ * @param {Vector3D} arg0
1190
+ */
1191
+ set rotation(arg0) {
1192
+ _assertClass(arg0, Vector3D);
1193
+ var ptr0 = arg0.__destroy_into_raw();
1194
+ wasm.__wbg_set_ogpolygon_rotation(this.__wbg_ptr, ptr0);
1195
+ }
1196
+ /**
1197
+ * @returns {Vector3D}
1198
+ */
1199
+ get scale() {
1200
+ const ret = wasm.__wbg_get_ogpolygon_scale(this.__wbg_ptr);
1201
+ return Vector3D.__wrap(ret);
1202
+ }
1203
+ /**
1204
+ * @param {Vector3D} arg0
1205
+ */
1206
+ set scale(arg0) {
1207
+ _assertClass(arg0, Vector3D);
1208
+ var ptr0 = arg0.__destroy_into_raw();
1209
+ wasm.__wbg_set_ogpolygon_scale(this.__wbg_ptr, ptr0);
1210
+ }
1211
+ /**
1212
+ * @param {string} id
1213
+ */
1214
+ set id(id) {
1215
+ const ptr0 = passStringToWasm0(id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1216
+ const len0 = WASM_VECTOR_LEN;
1217
+ wasm.ogpolygon_set_id(this.__wbg_ptr, ptr0, len0);
1218
+ }
1219
+ /**
1220
+ * @returns {string}
1221
+ */
1222
+ get id() {
1223
+ let deferred1_0;
1224
+ let deferred1_1;
1225
+ try {
1226
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1227
+ wasm.ogpolygon_id(retptr, this.__wbg_ptr);
1228
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1229
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1230
+ deferred1_0 = r0;
1231
+ deferred1_1 = r1;
1232
+ return getStringFromWasm0(r0, r1);
1233
+ } finally {
1234
+ wasm.__wbindgen_add_to_stack_pointer(16);
1235
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
1236
+ }
1237
+ }
1238
+ /**
1239
+ * @param {string} id
1240
+ */
1241
+ constructor(id) {
1242
+ const ptr0 = passStringToWasm0(id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1243
+ const len0 = WASM_VECTOR_LEN;
1244
+ const ret = wasm.ogpolygon_new(ptr0, len0);
1245
+ this.__wbg_ptr = ret >>> 0;
1246
+ OGPolygonFinalization.register(this, this.__wbg_ptr, this);
1247
+ return this;
1248
+ }
1249
+ /**
1250
+ * @param {CircleArc} circle_arc
1251
+ * @returns {OGPolygon}
1252
+ */
1253
+ static new_with_circle(circle_arc) {
1254
+ _assertClass(circle_arc, CircleArc);
1255
+ var ptr0 = circle_arc.__destroy_into_raw();
1256
+ const ret = wasm.ogpolygon_new_with_circle(ptr0);
1257
+ return OGPolygon.__wrap(ret);
1258
+ }
1259
+ /**
1260
+ * @param {OGRectangle} rectangle
1261
+ * @returns {OGPolygon}
1262
+ */
1263
+ static new_with_rectangle(rectangle) {
1264
+ _assertClass(rectangle, OGRectangle);
1265
+ var ptr0 = rectangle.__destroy_into_raw();
1266
+ const ret = wasm.ogpolygon_new_with_rectangle(ptr0);
1267
+ return OGPolygon.__wrap(ret);
1268
+ }
1269
+ /**
1270
+ * @param {(Vector3D)[]} vertices
1271
+ */
1272
+ add_vertices(vertices) {
1273
+ const ptr0 = passArrayJsValueToWasm0(vertices, wasm.__wbindgen_malloc);
1274
+ const len0 = WASM_VECTOR_LEN;
1275
+ wasm.ogpolygon_add_vertices(this.__wbg_ptr, ptr0, len0);
1276
+ }
1277
+ /**
1278
+ * @param {Vector3D} vertex
1279
+ */
1280
+ add_vertex(vertex) {
1281
+ _assertClass(vertex, Vector3D);
1282
+ var ptr0 = vertex.__destroy_into_raw();
1283
+ wasm.ogpolygon_add_vertex(this.__wbg_ptr, ptr0);
1284
+ }
1285
+ /**
1286
+ * @param {(Vector3D)[]} holes
1287
+ */
1288
+ add_holes(holes) {
1289
+ const ptr0 = passArrayJsValueToWasm0(holes, wasm.__wbindgen_malloc);
1290
+ const len0 = WASM_VECTOR_LEN;
1291
+ wasm.ogpolygon_add_holes(this.__wbg_ptr, ptr0, len0);
1292
+ }
1293
+ /**
1294
+ * @returns {string}
1295
+ */
1296
+ triangulate() {
1297
+ let deferred1_0;
1298
+ let deferred1_1;
1299
+ try {
1300
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1301
+ wasm.ogpolygon_triangulate(retptr, this.__wbg_ptr);
1302
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1303
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1304
+ deferred1_0 = r0;
1305
+ deferred1_1 = r1;
1306
+ return getStringFromWasm0(r0, r1);
1307
+ } finally {
1308
+ wasm.__wbindgen_add_to_stack_pointer(16);
1309
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
1310
+ }
1311
+ }
1312
+ /**
1313
+ * @param {boolean} is_ccw
1314
+ * @returns {string}
1315
+ */
1316
+ triangulate_with_holes_variable_geometry(is_ccw) {
1317
+ let deferred1_0;
1318
+ let deferred1_1;
1319
+ try {
1320
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1321
+ wasm.ogpolygon_triangulate_with_holes_variable_geometry(retptr, this.__wbg_ptr, is_ccw);
1322
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1323
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1324
+ deferred1_0 = r0;
1325
+ deferred1_1 = r1;
1326
+ return getStringFromWasm0(r0, r1);
1327
+ } finally {
1328
+ wasm.__wbindgen_add_to_stack_pointer(16);
1329
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
1330
+ }
1331
+ }
1332
+ /**
1333
+ * @returns {string}
1334
+ */
1335
+ triangulate_with_holes() {
1336
+ let deferred1_0;
1337
+ let deferred1_1;
1338
+ try {
1339
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1340
+ wasm.ogpolygon_triangulate_with_holes(retptr, this.__wbg_ptr);
1341
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1342
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1343
+ deferred1_0 = r0;
1344
+ deferred1_1 = r1;
1345
+ return getStringFromWasm0(r0, r1);
1346
+ } finally {
1347
+ wasm.__wbindgen_add_to_stack_pointer(16);
1348
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
1349
+ }
1350
+ }
1351
+ /**
1352
+ * @returns {string}
1353
+ */
1354
+ get_buffer_flush() {
1355
+ let deferred1_0;
1356
+ let deferred1_1;
1357
+ try {
1358
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1359
+ wasm.ogpolygon_get_buffer_flush(retptr, this.__wbg_ptr);
1360
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1361
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1362
+ deferred1_0 = r0;
1363
+ deferred1_1 = r1;
1364
+ return getStringFromWasm0(r0, r1);
1365
+ } finally {
1366
+ wasm.__wbindgen_add_to_stack_pointer(16);
1367
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
1368
+ }
1369
+ }
1370
+ /**
1371
+ */
1372
+ clear_vertices() {
1373
+ wasm.ogpolygon_clear_vertices(this.__wbg_ptr);
1374
+ }
1375
+ /**
1376
+ */
1377
+ reset_polygon() {
1378
+ wasm.ogpolygon_reset_polygon(this.__wbg_ptr);
1379
+ }
1380
+ /**
1381
+ * @param {number} height
1382
+ * @returns {string}
1383
+ */
1384
+ extrude_by_height_with_holes(height) {
1385
+ let deferred1_0;
1386
+ let deferred1_1;
1387
+ try {
1388
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1389
+ wasm.ogpolygon_extrude_by_height_with_holes(retptr, this.__wbg_ptr, height);
1390
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1391
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1392
+ deferred1_0 = r0;
1393
+ deferred1_1 = r1;
1394
+ return getStringFromWasm0(r0, r1);
1395
+ } finally {
1396
+ wasm.__wbindgen_add_to_stack_pointer(16);
1397
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
1398
+ }
1399
+ }
1400
+ /**
1401
+ * @param {number} height
1402
+ * @returns {string}
1403
+ */
1404
+ extrude_by_height(height) {
1405
+ let deferred1_0;
1406
+ let deferred1_1;
1407
+ try {
1408
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1409
+ wasm.ogpolygon_extrude_by_height(retptr, this.__wbg_ptr, height);
1410
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1411
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1412
+ deferred1_0 = r0;
1413
+ deferred1_1 = r1;
1414
+ return getStringFromWasm0(r0, r1);
1415
+ } finally {
1416
+ wasm.__wbindgen_add_to_stack_pointer(16);
1417
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
1418
+ }
1419
+ }
1420
+ /**
1421
+ * @returns {string}
1422
+ */
1423
+ get_outlines() {
1424
+ let deferred1_0;
1425
+ let deferred1_1;
1426
+ try {
1427
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1428
+ wasm.ogpolygon_get_outlines(retptr, this.__wbg_ptr);
1429
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1430
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1431
+ deferred1_0 = r0;
1432
+ deferred1_1 = r1;
1433
+ return getStringFromWasm0(r0, r1);
1434
+ } finally {
1435
+ wasm.__wbindgen_add_to_stack_pointer(16);
1436
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
1437
+ }
1438
+ }
1439
+ /**
1440
+ * @returns {string}
1441
+ */
1442
+ get_geometry() {
1443
+ let deferred1_0;
1444
+ let deferred1_1;
1445
+ try {
1446
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1447
+ wasm.ogpolygon_get_geometry(retptr, this.__wbg_ptr);
1448
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1449
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1450
+ deferred1_0 = r0;
1451
+ deferred1_1 = r1;
1452
+ return getStringFromWasm0(r0, r1);
1453
+ } finally {
1454
+ wasm.__wbindgen_add_to_stack_pointer(16);
1455
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
1456
+ }
1457
+ }
1458
+ /**
1459
+ * @returns {string}
1460
+ */
1461
+ get_brep_data() {
924
1462
  let deferred1_0;
925
1463
  let deferred1_1;
926
1464
  try {
927
1465
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
928
- wasm.ogpolyline_get_points(retptr, this.__wbg_ptr);
1466
+ wasm.ogpolygon_get_brep_data(retptr, this.__wbg_ptr);
929
1467
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
930
1468
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
931
1469
  deferred1_0 = r0;
@@ -937,33 +1475,24 @@ class OGPolyLine {
937
1475
  }
938
1476
  }
939
1477
  /**
940
- * @returns {(Vector3D)[]}
1478
+ * @returns {string}
941
1479
  */
942
- get_raw_points() {
1480
+ outline_edges() {
1481
+ let deferred1_0;
1482
+ let deferred1_1;
943
1483
  try {
944
1484
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
945
- wasm.ogpolyline_get_raw_points(retptr, this.__wbg_ptr);
1485
+ wasm.ogpolygon_outline_edges(retptr, this.__wbg_ptr);
946
1486
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
947
1487
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
948
- var v1 = getArrayJsValueFromWasm0(r0, r1).slice();
949
- wasm.__wbindgen_free(r0, r1 * 4, 4);
950
- return v1;
1488
+ deferred1_0 = r0;
1489
+ deferred1_1 = r1;
1490
+ return getStringFromWasm0(r0, r1);
951
1491
  } finally {
952
1492
  wasm.__wbindgen_add_to_stack_pointer(16);
1493
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
953
1494
  }
954
1495
  }
955
- /**
956
- * @returns {boolean}
957
- */
958
- is_closed() {
959
- const ret = wasm.ogpolyline_is_closed(this.__wbg_ptr);
960
- return ret !== 0;
961
- }
962
- /**
963
- */
964
- check_closed_test() {
965
- wasm.ogpolyline_check_closed_test(this.__wbg_ptr);
966
- }
967
1496
  }
968
1497
  const OGRectangleFinalization = typeof FinalizationRegistry === 'undefined' ? {
969
1498
  register: () => {},
@@ -1198,12 +1727,12 @@ class OGSimpleLine {
1198
1727
  /**
1199
1728
  */
1200
1729
  dispose_points() {
1201
- wasm.ogpolyline_destroy(this.__wbg_ptr);
1730
+ wasm.ogsimpleline_destroy(this.__wbg_ptr);
1202
1731
  }
1203
1732
  /**
1204
1733
  */
1205
1734
  destroy() {
1206
- wasm.ogpolyline_destroy(this.__wbg_ptr);
1735
+ wasm.ogsimpleline_destroy(this.__wbg_ptr);
1207
1736
  }
1208
1737
  /**
1209
1738
  * @returns {string}
@@ -12070,6 +12599,56 @@ function checkIntersection( object, raycaster, ray, thresholdSq, a, b ) {
12070
12599
 
12071
12600
  }
12072
12601
 
12602
+ const _start = /*@__PURE__*/ new Vector3();
12603
+ const _end = /*@__PURE__*/ new Vector3();
12604
+
12605
+ class LineSegments extends Line {
12606
+
12607
+ constructor( geometry, material ) {
12608
+
12609
+ super( geometry, material );
12610
+
12611
+ this.isLineSegments = true;
12612
+
12613
+ this.type = 'LineSegments';
12614
+
12615
+ }
12616
+
12617
+ computeLineDistances() {
12618
+
12619
+ const geometry = this.geometry;
12620
+
12621
+ // we assume non-indexed geometry
12622
+
12623
+ if ( geometry.index === null ) {
12624
+
12625
+ const positionAttribute = geometry.attributes.position;
12626
+ const lineDistances = [];
12627
+
12628
+ for ( let i = 0, l = positionAttribute.count; i < l; i += 2 ) {
12629
+
12630
+ _start.fromBufferAttribute( positionAttribute, i );
12631
+ _end.fromBufferAttribute( positionAttribute, i + 1 );
12632
+
12633
+ lineDistances[ i ] = ( i === 0 ) ? 0 : lineDistances[ i - 1 ];
12634
+ lineDistances[ i + 1 ] = lineDistances[ i ] + _start.distanceTo( _end );
12635
+
12636
+ }
12637
+
12638
+ geometry.setAttribute( 'lineDistance', new Float32BufferAttribute( lineDistances, 1 ) );
12639
+
12640
+ } else {
12641
+
12642
+ console.warn( 'THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.' );
12643
+
12644
+ }
12645
+
12646
+ return this;
12647
+
12648
+ }
12649
+
12650
+ }
12651
+
12073
12652
  class MeshStandardMaterial extends Material {
12074
12653
 
12075
12654
  constructor( parameters ) {
@@ -13011,6 +13590,7 @@ class BaseCircle extends Line {
13011
13590
  this.circleArc.generate_points();
13012
13591
  const bufRaw = this.circleArc.get_points();
13013
13592
  const bufFlush = JSON.parse(bufRaw);
13593
+ console.log(bufFlush);
13014
13594
  const line = new BufferGeometry().setFromPoints(bufFlush);
13015
13595
  const material = new LineBasicMaterial({ color: 0x000000 });
13016
13596
  this.geometry = line;
@@ -13080,6 +13660,248 @@ class Rectangle extends Line {
13080
13660
  }
13081
13661
  _Rectangle_color = new WeakMap();
13082
13662
 
13663
+ var _Cylinder_outlineMesh;
13664
+ class Cylinder extends Mesh {
13665
+ constructor(options) {
13666
+ super();
13667
+ _Cylinder_outlineMesh.set(this, null);
13668
+ // Store local center offset to align outlines
13669
+ // TODO: Can this be moved to Engine? It can increase performance | Needs to be used in other shapes too
13670
+ this._geometryCenterOffset = new Vector3();
13671
+ this.ogid = getUUID();
13672
+ this.options = options;
13673
+ this.cylinder = new OGCylinder(this.ogid);
13674
+ this.setConfig();
13675
+ this.generateGeometry();
13676
+ }
13677
+ validateOptions() {
13678
+ if (!this.options) {
13679
+ throw new Error("Options are not defined for Cylinder");
13680
+ }
13681
+ }
13682
+ setConfig() {
13683
+ this.validateOptions();
13684
+ const { radius, height, segments, angle, center } = this.options;
13685
+ this.cylinder.set_config((center === null || center === void 0 ? void 0 : center.clone()) || new Vector3D(0, 0, 0), radius, height, angle, segments);
13686
+ }
13687
+ generateGeometry() {
13688
+ var _a, _b, _c;
13689
+ this.cylinder.generate_geometry();
13690
+ const geometryData = this.cylinder.get_geometry();
13691
+ const bufferData = JSON.parse(geometryData);
13692
+ console.log(bufferData);
13693
+ const geometry = new BufferGeometry();
13694
+ geometry.setAttribute("position", new Float32BufferAttribute(bufferData, 3));
13695
+ const material = new MeshStandardMaterial({
13696
+ color: 0x00ff00,
13697
+ transparent: true,
13698
+ opacity: 0.6,
13699
+ });
13700
+ geometry.computeVertexNormals();
13701
+ geometry.computeBoundingBox();
13702
+ const boundingBox = geometry.boundingBox;
13703
+ if (boundingBox) {
13704
+ boundingBox.getCenter(this._geometryCenterOffset);
13705
+ geometry.translate(-this._geometryCenterOffset.x, -this._geometryCenterOffset.y, -this._geometryCenterOffset.z);
13706
+ }
13707
+ this.geometry = geometry;
13708
+ this.material = material;
13709
+ this.position.set(((_a = this.options.center) === null || _a === void 0 ? void 0 : _a.x) || 0, ((_b = this.options.center) === null || _b === void 0 ? void 0 : _b.y) || 0, ((_c = this.options.center) === null || _c === void 0 ? void 0 : _c.z) || 0);
13710
+ }
13711
+ set outline(enable) {
13712
+ if (enable && !__classPrivateFieldGet(this, _Cylinder_outlineMesh, "f")) {
13713
+ const outline_buff = this.cylinder.outline_edges();
13714
+ const outline_buf = JSON.parse(outline_buff);
13715
+ const outlineGeometry = new BufferGeometry();
13716
+ outlineGeometry.setAttribute("position", new Float32BufferAttribute(outline_buf, 3));
13717
+ outlineGeometry.translate(-this._geometryCenterOffset.x, -this._geometryCenterOffset.y, -this._geometryCenterOffset.z);
13718
+ const outlineMaterial = new LineBasicMaterial({ color: 0x000000 });
13719
+ __classPrivateFieldSet(this, _Cylinder_outlineMesh, new LineSegments(outlineGeometry, outlineMaterial), "f");
13720
+ this.add(__classPrivateFieldGet(this, _Cylinder_outlineMesh, "f"));
13721
+ }
13722
+ if (!enable && __classPrivateFieldGet(this, _Cylinder_outlineMesh, "f")) {
13723
+ this.remove(__classPrivateFieldGet(this, _Cylinder_outlineMesh, "f"));
13724
+ __classPrivateFieldGet(this, _Cylinder_outlineMesh, "f").geometry.dispose();
13725
+ __classPrivateFieldSet(this, _Cylinder_outlineMesh, null, "f");
13726
+ }
13727
+ }
13728
+ getBrepData() {
13729
+ const brepData = this.cylinder.get_brep_dump();
13730
+ const brepDataParsed = JSON.parse(brepData);
13731
+ console.log(brepDataParsed);
13732
+ }
13733
+ }
13734
+ _Cylinder_outlineMesh = new WeakMap();
13735
+
13736
+ var _Polygon_outlineMesh;
13737
+ class Polygon extends Mesh {
13738
+ constructor(vertices) {
13739
+ var _a, _b;
13740
+ super();
13741
+ this.layerVertices = [];
13742
+ this.layerBackVertices = [];
13743
+ this.polygon = null;
13744
+ this.isTriangulated = false;
13745
+ _Polygon_outlineMesh.set(this, null);
13746
+ this._geometryCenterOffset = new Vector3();
13747
+ this.ogid = getUUID();
13748
+ this.polygon = new OGPolygon(this.ogid);
13749
+ if (vertices) {
13750
+ this.polygon.add_vertices(vertices);
13751
+ // Triangulate the polygon - WORKS
13752
+ (_a = this.polygon) === null || _a === void 0 ? void 0 : _a.triangulate();
13753
+ const bufFlush = (_b = this.polygon) === null || _b === void 0 ? void 0 : _b.get_buffer_flush();
13754
+ this.addFlushBufferToScene(bufFlush);
13755
+ // Testing New Triangulation - FAILING
13756
+ // const triResult = JSON.parse(this.polygon.new_triangulate());
13757
+ // console.log(triResult);
13758
+ }
13759
+ // THIS MIGHT HELP WITH SHARING THE POSITION with KERNEL when something is changed
13760
+ // const originalSet = this.position.set.bind(this.position);
13761
+ // this.position.set = (x: number, y: number, z: number) => {
13762
+ // console.log(`Position set to (${x}, ${y}, ${z})`);
13763
+ // // your custom logic here (e.g., notify OpenGeometry)
13764
+ // return originalSet(x, y, z);
13765
+ // };
13766
+ // // Optional: Override copy if you're using .copy() too
13767
+ // const originalCopy = this.position.copy.bind(this.position);
13768
+ // this.position.copy = (v: THREE.Vector3) => {
13769
+ // console.log(`Position copied from ${v.x}, ${v.y}, ${v.z}`);
13770
+ // return originalCopy(v);
13771
+ // };
13772
+ }
13773
+ addVertices(vertices) {
13774
+ var _a, _b;
13775
+ if (!this.polygon)
13776
+ return;
13777
+ this.polygon.add_vertices(vertices);
13778
+ (_a = this.polygon) === null || _a === void 0 ? void 0 : _a.triangulate();
13779
+ const bufFlush = (_b = this.polygon) === null || _b === void 0 ? void 0 : _b.get_buffer_flush();
13780
+ this.addFlushBufferToScene(bufFlush);
13781
+ }
13782
+ resetVertices() {
13783
+ var _a;
13784
+ if (!this.polygon)
13785
+ return;
13786
+ this.layerVertices = [];
13787
+ this.geometry.dispose();
13788
+ (_a = this.polygon) === null || _a === void 0 ? void 0 : _a.reset_polygon();
13789
+ this.isTriangulated = false;
13790
+ }
13791
+ addVertex(threeVertex) {
13792
+ var _a, _b, _c;
13793
+ if (this.isTriangulated) {
13794
+ this.layerVertices = [];
13795
+ this.geometry.dispose();
13796
+ (_a = this.polygon) === null || _a === void 0 ? void 0 : _a.reset_polygon();
13797
+ this.isTriangulated = false;
13798
+ for (const vertex of this.layerBackVertices) {
13799
+ this.layerVertices.push(vertex.clone());
13800
+ }
13801
+ }
13802
+ const backupVertex = new Vector3D(parseFloat(threeVertex.x.toFixed(2)), 0, parseFloat(threeVertex.z.toFixed(2)));
13803
+ this.layerBackVertices.push(backupVertex);
13804
+ const vertex = new Vector3D(parseFloat(threeVertex.x.toFixed(2)),
13805
+ // when doing the parse operation getting -0 instead of 0
13806
+ 0, parseFloat(threeVertex.z.toFixed(2)));
13807
+ this.layerVertices.push(vertex);
13808
+ if (this.layerVertices.length > 3) {
13809
+ (_b = this.polygon) === null || _b === void 0 ? void 0 : _b.add_vertices(this.layerVertices);
13810
+ const bufFlush = (_c = this.polygon) === null || _c === void 0 ? void 0 : _c.triangulate();
13811
+ if (!bufFlush) {
13812
+ return;
13813
+ }
13814
+ this.addFlushBufferToScene(bufFlush);
13815
+ this.isTriangulated = true;
13816
+ }
13817
+ }
13818
+ addHole(holeVertices) {
13819
+ if (!this.polygon)
13820
+ return;
13821
+ this.polygon.add_holes(holeVertices);
13822
+ const triResult = JSON.parse(this.polygon.triangulate_with_holes());
13823
+ console.log(triResult);
13824
+ const newBufferFlush = triResult.new_buffer;
13825
+ const geometry = new BufferGeometry();
13826
+ geometry.setAttribute("position", new BufferAttribute(new Float32Array(newBufferFlush), 3));
13827
+ this.geometry = geometry;
13828
+ // const bufFlush = this.polygon.get_buffer_flush();
13829
+ // this.addFlushBufferToScene(bufFlush);
13830
+ }
13831
+ addFlushBufferToScene(flush) {
13832
+ const flushBuffer = JSON.parse(flush);
13833
+ const geometry = new BufferGeometry();
13834
+ geometry.setAttribute("position", new BufferAttribute(new Float32Array(flushBuffer), 3));
13835
+ geometry.computeVertexNormals();
13836
+ const material = new MeshStandardMaterial({
13837
+ color: 0x00ff00,
13838
+ // side: THREE.DoubleSide,
13839
+ transparent: true,
13840
+ opacity: 0.5,
13841
+ // wireframe: true
13842
+ });
13843
+ this.geometry = geometry;
13844
+ this.material = material;
13845
+ }
13846
+ extrude(height) {
13847
+ if (!this.polygon)
13848
+ return;
13849
+ const extruded_buff = this.polygon.extrude_by_height(height);
13850
+ console.log(extruded_buff);
13851
+ this.generateExtrudedGeometry(extruded_buff);
13852
+ }
13853
+ generateExtrudedGeometry(extruded_buff) {
13854
+ // THIS WORKS
13855
+ const flushBuffer = JSON.parse(extruded_buff);
13856
+ console.log(flushBuffer);
13857
+ const geometry = new BufferGeometry();
13858
+ geometry.setAttribute("position", new BufferAttribute(new Float32Array(flushBuffer), 3));
13859
+ geometry.computeVertexNormals();
13860
+ this.geometry = geometry;
13861
+ // const material = new THREE.MeshStandardMaterial({
13862
+ // color: 0x3a86ff,
13863
+ // });
13864
+ // // material.side = THREE.DoubleSide;
13865
+ // this.material = material;
13866
+ }
13867
+ getBrepData() {
13868
+ if (!this.polygon)
13869
+ return;
13870
+ const brepData = this.polygon.get_brep_data();
13871
+ const parsedData = JSON.parse(brepData);
13872
+ console.log(parsedData);
13873
+ }
13874
+ set outline(enable) {
13875
+ if (enable && !__classPrivateFieldGet(this, _Polygon_outlineMesh, "f") && this.polygon) {
13876
+ const outline_buff = this.polygon.outline_edges();
13877
+ const outline_buf = JSON.parse(outline_buff);
13878
+ const outlineGeometry = new BufferGeometry();
13879
+ outlineGeometry.setAttribute("position", new Float32BufferAttribute(outline_buf, 3));
13880
+ // TODO: Fix the outline position
13881
+ // outlineGeometry.translate(
13882
+ // -this._geometryCenterOffset.x,
13883
+ // -this._geometryCenterOffset.y,
13884
+ // -this._geometryCenterOffset.z
13885
+ // );
13886
+ const outlineMaterial = new LineBasicMaterial({ color: 0x000000 });
13887
+ __classPrivateFieldSet(this, _Polygon_outlineMesh, new LineSegments(outlineGeometry, outlineMaterial), "f");
13888
+ this.add(__classPrivateFieldGet(this, _Polygon_outlineMesh, "f"));
13889
+ }
13890
+ if (!enable && __classPrivateFieldGet(this, _Polygon_outlineMesh, "f")) {
13891
+ this.remove(__classPrivateFieldGet(this, _Polygon_outlineMesh, "f"));
13892
+ __classPrivateFieldGet(this, _Polygon_outlineMesh, "f").geometry.dispose();
13893
+ __classPrivateFieldSet(this, _Polygon_outlineMesh, null, "f");
13894
+ }
13895
+ }
13896
+ get outline() {
13897
+ if (__classPrivateFieldGet(this, _Polygon_outlineMesh, "f")) {
13898
+ return true;
13899
+ }
13900
+ return false;
13901
+ }
13902
+ }
13903
+ _Polygon_outlineMesh = new WeakMap();
13904
+
13083
13905
  class OpenGeometry {
13084
13906
  constructor(container, threeScene, camera) {
13085
13907
  this.camera = camera;
@@ -13210,15 +14032,11 @@ class BasePoly extends Mesh {
13210
14032
  }
13211
14033
  }
13212
14034
  addHole(holeVertices) {
13213
- console.log(holeVertices);
13214
14035
  if (!this.polygon)
13215
14036
  return;
13216
14037
  this.polygon.add_holes(holeVertices);
13217
- console.log(this.polygon.get_geometry());
13218
14038
  const triResult = JSON.parse(this.polygon.new_triangulate());
13219
- console.log(triResult);
13220
14039
  const newBufferFlush = triResult.new_buffer;
13221
- console.log(newBufferFlush);
13222
14040
  const geometry = new BufferGeometry();
13223
14041
  geometry.setAttribute("position", new BufferAttribute(new Float32Array(newBufferFlush), 3));
13224
14042
  this.geometry = geometry;
@@ -13227,14 +14045,38 @@ class BasePoly extends Mesh {
13227
14045
  }
13228
14046
  addFlushBufferToScene(flush) {
13229
14047
  const flushBuffer = JSON.parse(flush);
13230
- console.log(flushBuffer);
13231
14048
  const geometry = new BufferGeometry();
13232
14049
  geometry.setAttribute("position", new BufferAttribute(new Float32Array(flushBuffer), 3));
13233
- const material = new MeshStandardMaterial({ color: 0x3a86ff, transparent: true, opacity: 0.5 });
14050
+ // geometry.computeVertexNormals();
14051
+ const material = new MeshStandardMaterial({
14052
+ color: 0x00ff00,
14053
+ // side: THREE.DoubleSide,
14054
+ transparent: true,
14055
+ opacity: 0.5,
14056
+ // wireframe: true
14057
+ });
13234
14058
  this.geometry = geometry;
13235
14059
  this.material = material;
13236
- // this.geometry.attributes.position.needsUpdate = true;
13237
- // this.geometry.computeVertexNormals();
14060
+ }
14061
+ extrude(height) {
14062
+ if (!this.polygon)
14063
+ return;
14064
+ const extruded_buff = this.polygon.extrude_by_height(height);
14065
+ this.generateExtrudedGeometry(extruded_buff);
14066
+ }
14067
+ generateExtrudedGeometry(extruded_buff) {
14068
+ // THIS WORKS
14069
+ const flushBuffer = JSON.parse(extruded_buff);
14070
+ console.log(flushBuffer);
14071
+ // const geometry = new THREE.BufferGeometry();
14072
+ // geometry.setAttribute("position", new THREE.BufferAttribute(new Float32Array(flushBuffer), 3));
14073
+ // // geometry.computeVertexNormals();
14074
+ // // const material = new THREE.MeshPhongMaterial({
14075
+ // // color: 0x3a86ff,
14076
+ // // });
14077
+ // // material.side = THREE.DoubleSide;
14078
+ // this.geometry = geometry;
14079
+ // this.material = material;
13238
14080
  }
13239
14081
  }
13240
14082
  class CirclePoly extends Mesh {
@@ -13263,41 +14105,39 @@ class CirclePoly extends Mesh {
13263
14105
  generateGeometry() {
13264
14106
  if (!this.baseCircle.circleArc)
13265
14107
  return;
13266
- this.polygon = BasePolygon.new_with_circle(this.baseCircle.circleArc.clone());
14108
+ this.polygon = OGPolygon.new_with_circle(this.baseCircle.circleArc.clone());
13267
14109
  }
13268
14110
  addFlushBufferToScene() {
13269
14111
  if (!this.polygon)
13270
14112
  return;
13271
14113
  const bufFlush = this.polygon.get_buffer_flush();
13272
14114
  const flushBuffer = JSON.parse(bufFlush);
13273
- console.log(flushBuffer);
13274
14115
  const geometry = new BufferGeometry();
13275
14116
  geometry.setAttribute("position", new BufferAttribute(new Float32Array(flushBuffer), 3));
14117
+ // TODO: Do this using a set method, poly.visualizeTriangles = true
13276
14118
  // different colors for each triangle in the polygon dont interolate
13277
- const colors = new Float32Array(flushBuffer.length);
13278
- for (let i = 0; i < colors.length; i += 9) {
13279
- const r = Math.random();
13280
- const g = Math.random();
13281
- const b = Math.random();
13282
- colors[i] = r;
13283
- colors[i + 1] = g;
13284
- colors[i + 2] = b;
13285
- colors[i + 3] = r;
13286
- colors[i + 4] = g;
13287
- colors[i + 5] = b;
13288
- colors[i + 6] = r;
13289
- colors[i + 7] = g;
13290
- colors[i + 8] = b;
13291
- }
13292
- geometry.setAttribute('color', new BufferAttribute(colors, 3));
13293
- const material = new MeshPhongMaterial({
13294
- color: 0xffffff,
13295
- flatShading: true,
13296
- vertexColors: true,
13297
- shininess: 0,
13298
- side: DoubleSide,
14119
+ // const colors = new Float32Array(flushBuffer.length);
14120
+ // for (let i = 0; i < colors.length; i += 9) {
14121
+ // const r = Math.random();
14122
+ // const g = Math.random();
14123
+ // const b = Math.random();
14124
+ // colors[i] = r;
14125
+ // colors[i + 1] = g;
14126
+ // colors[i + 2] = b;
14127
+ // colors[i + 3] = r;
14128
+ // colors[i + 4] = g;
14129
+ // colors[i + 5] = b;
14130
+ // colors[i + 6] = r;
14131
+ // colors[i + 7] = g;
14132
+ // colors[i + 8] = b;
14133
+ // }
14134
+ // geometry.setAttribute('color', new THREE.BufferAttribute(colors, 3));
14135
+ const material = new MeshStandardMaterial({
14136
+ color: 0x00ff00,
14137
+ // side: THREE.DoubleSide,
13299
14138
  transparent: true,
13300
- opacity: 0.1
14139
+ opacity: 0.5,
14140
+ // wireframe: true
13301
14141
  });
13302
14142
  this.geometry = geometry;
13303
14143
  this.material = material;
@@ -13313,6 +14153,13 @@ class CirclePoly extends Mesh {
13313
14153
  this.isExtruded = true;
13314
14154
  this.generateExtrudedGeometry(extruded_buff);
13315
14155
  }
14156
+ getBrepData() {
14157
+ if (!this.polygon)
14158
+ return;
14159
+ const brepData = this.polygon.get_brep_data();
14160
+ const parsedData = JSON.parse(brepData);
14161
+ console.log(parsedData);
14162
+ }
13316
14163
  getOutline(type) {
13317
14164
  if (!this.polygon)
13318
14165
  return;
@@ -13357,7 +14204,6 @@ class CirclePoly extends Mesh {
13357
14204
  center.add(vertex);
13358
14205
  }
13359
14206
  center.divideScalar(uniqueVertices.length);
13360
- console.log(center);
13361
14207
  uniqueVertices.sort((a, b) => {
13362
14208
  if (type === "side") {
13363
14209
  const angleA = Math.atan2(a.y - center.y, a.z - center.z);
@@ -13398,7 +14244,6 @@ class CirclePoly extends Mesh {
13398
14244
  const flushBuffer = JSON.parse(extruded_buff);
13399
14245
  const geometry = new BufferGeometry();
13400
14246
  geometry.setAttribute("position", new BufferAttribute(new Float32Array(flushBuffer), 3));
13401
- geometry.computeVertexNormals();
13402
14247
  // To Test If Triangulation is working
13403
14248
  // const colors = new Float32Array(flushBuffer.length);
13404
14249
  // for (let i = 0; i < colors.length; i += 9) {
@@ -13423,12 +14268,12 @@ class CirclePoly extends Mesh {
13423
14268
  // shininess: 0,
13424
14269
  // side: THREE.DoubleSide
13425
14270
  // });
13426
- const material = new MeshPhongMaterial({
13427
- color: 0x3a86ff,
13428
- });
13429
- material.side = DoubleSide;
14271
+ // const material = new THREE.MeshPhongMaterial({
14272
+ // color: 0x3a86ff,
14273
+ // });
14274
+ // material.side = THREE.DoubleSide;
13430
14275
  this.geometry = geometry;
13431
- this.material = material;
14276
+ // this.material = material;
13432
14277
  }
13433
14278
  }
13434
14279
  class RectanglePoly extends Mesh {
@@ -13464,7 +14309,6 @@ class RectanglePoly extends Mesh {
13464
14309
  return;
13465
14310
  const bufFlush = this.polygon.get_buffer_flush();
13466
14311
  const flushBuffer = JSON.parse(bufFlush);
13467
- console.log(flushBuffer);
13468
14312
  const geometry = new BufferGeometry();
13469
14313
  geometry.setAttribute("position", new BufferAttribute(new Float32Array(flushBuffer), 3));
13470
14314
  const material = new MeshStandardMaterial({ color: 0x3a86ff, transparent: true, opacity: 0.5 });
@@ -13478,7 +14322,6 @@ class RectanglePoly extends Mesh {
13478
14322
  if (!this.polygon)
13479
14323
  return;
13480
14324
  const extruded_buff = this.polygon.extrude_by_height(height);
13481
- console.log(JSON.parse(extruded_buff));
13482
14325
  this.isExtruded = true;
13483
14326
  this.generateExtrudedGeometry(extruded_buff);
13484
14327
  }
@@ -13562,7 +14405,6 @@ class RectanglePoly extends Mesh {
13562
14405
  center.add(vertex);
13563
14406
  }
13564
14407
  center.divideScalar(uniqueVertices.length);
13565
- console.log(center);
13566
14408
  uniqueVertices.sort((a, b) => {
13567
14409
  if (type === "side") {
13568
14410
  const angleA = Math.atan2(a.y - center.y, a.z - center.z);
@@ -13617,5 +14459,5 @@ class FlatMesh extends Mesh {
13617
14459
  }
13618
14460
  }
13619
14461
 
13620
- export { BaseCircle, BasePoly, CirclePoly, FlatMesh, OpenGeometry, PolyLine, Rectangle, RectanglePoly, SimpleLine, SpotLabel, Vector3D };
14462
+ export { BaseCircle, BasePoly, CirclePoly, Cylinder, FlatMesh, OpenGeometry, PolyLine, Polygon, Rectangle, RectanglePoly, SimpleLine, SpotLabel, Vector3D };
13621
14463
  //# sourceMappingURL=index.js.map