opengeometry 0.0.1

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/README.md ADDED
@@ -0,0 +1,39 @@
1
+ ## 🚧 Under Development 🚧
2
+
3
+ **This project is currently a work in progress!**
4
+ Expect frequent updates, breaking changes, and exciting new features.
5
+
6
+ # OpenGeometry
7
+
8
+ #### Initialize Library
9
+
10
+ - `const openGeometry = new OpenGeometry()`
11
+ - `await openGeometry.setup()`
12
+
13
+ #### Create Polygon
14
+ - `const oPoly = new OPolygon()`
15
+
16
+ ##### Add Points to Polygon
17
+ - addVertex(x:number, y:number, z:number) - Add Point to the Given Polygon
18
+
19
+ ##### Generate Flat 2D Mesh
20
+ - generateMesh() - Created a Flat 2D Mesh from the given Vertices
21
+ - Minimum 3 Vertices are needed, else ask users for it
22
+
23
+ ### Extrude
24
+ - Extrude is a operation which elevates the given 2D polygon by a given height
25
+ - `polygon.extrude(height: number)`
26
+ - returns a Buffer Geometry
27
+
28
+ - Scene Graph (List of Objects)
29
+ - Access to Scene Graph for other classes
30
+ - Bounding Boxes for BaseGeometry (min, max)
31
+ - Check Intersection with existing BBoxes - multiple cases - Partial Outside | Inside | Touching | Outside
32
+
33
+ ### Test
34
+ #### Basic Example
35
+ - A basic example is available at `./test/index.html`
36
+
37
+ #### Advanced and Additional Examples
38
+ - Extensive Examples(Source Code) have a separate repo - https://github.com/OpenGeometry-io/OpenGeometry-examples
39
+ - The live demo is available at [Kernel Examples](https://demos.opengeometry.io/examples/kernel/index.html)
package/index.d.ts ADDED
@@ -0,0 +1,74 @@
1
+ import { Vector3D, BasePolygon } from "../opengeometry/pkg/opengeometry";
2
+ import * as THREE from "three";
3
+ import { CSS2DRenderer } from "three/examples/jsm/renderers/CSS2DRenderer.js";
4
+ import { Pencil } from "./src/pencil";
5
+ import { SpotLabel } from "./src/markup/spotMarker";
6
+ import { OpenGeometryOptions } from "./src/base-types";
7
+ import { BaseCircle } from "./src/primitives/circle";
8
+ import { Rectangle } from "./src/primitives/rectangle";
9
+ export type OUTLINE_TYPE = "front" | "side" | "top";
10
+ export declare class OpenGeometry {
11
+ private camera;
12
+ static version: string;
13
+ protected scene: THREE.Scene | undefined;
14
+ protected container: HTMLElement | undefined;
15
+ private _pencil;
16
+ private _labelRenderer;
17
+ constructor(container: HTMLElement, threeScene: THREE.Scene, camera: THREE.Camera);
18
+ static create(options: OpenGeometryOptions): Promise<OpenGeometry>;
19
+ private setup;
20
+ get pencil(): Pencil | undefined;
21
+ get labelRenderer(): CSS2DRenderer | undefined;
22
+ setuplabelRenderer(): void;
23
+ setupEvent(): void;
24
+ update(scene: THREE.Scene, camera: THREE.Camera): void;
25
+ }
26
+ export declare class BasePoly extends THREE.Mesh {
27
+ ogid: string;
28
+ layerVertices: Vector3D[];
29
+ layerBackVertices: Vector3D[];
30
+ polygon: BasePolygon | null;
31
+ isTriangulated: boolean;
32
+ constructor(vertices?: Vector3D[]);
33
+ addVertices(vertices: Vector3D[]): void;
34
+ resetVertices(): void;
35
+ addVertex(threeVertex: Vector3D): void;
36
+ addHole(holeVertices: Vector3D[]): void;
37
+ addFlushBufferToScene(flush: string): void;
38
+ }
39
+ export declare class CirclePoly extends THREE.Mesh {
40
+ ogid: string;
41
+ polygon: BasePolygon | null;
42
+ baseCircle: BaseCircle;
43
+ isExtruded: boolean;
44
+ constructor(baseCircle: BaseCircle);
45
+ update(): void;
46
+ generateGeometry(): void;
47
+ addFlushBufferToScene(): void;
48
+ clearGeometry(): void;
49
+ extrude(height: number): void;
50
+ getOutline(type: OUTLINE_TYPE): THREE.Line<THREE.BufferGeometry<THREE.NormalBufferAttributes>, THREE.MeshBasicMaterial, THREE.Object3DEventMap> | undefined;
51
+ generateExtrudedGeometry(extruded_buff: string): void;
52
+ }
53
+ export declare class RectanglePoly extends THREE.Mesh {
54
+ ogid: string;
55
+ polygon: BasePolygon | null;
56
+ baseRectangle: Rectangle;
57
+ isExtruded: boolean;
58
+ constructor(baseRectangle: Rectangle);
59
+ update(): void;
60
+ generateGeometry(): void;
61
+ addFlushBufferToScene(): void;
62
+ clearGeometry(): void;
63
+ extrude(height: number): void;
64
+ generateExtrudedGeometry(extruded_buff: string): void;
65
+ getOutline(type: OUTLINE_TYPE): THREE.Line<THREE.BufferGeometry<THREE.NormalBufferAttributes>, THREE.MeshBasicMaterial, THREE.Object3DEventMap> | undefined;
66
+ }
67
+ /**
68
+ * Base Flat Mesh
69
+ */
70
+ export declare class FlatMesh extends THREE.Mesh {
71
+ constructor(vertices: Vector3D[]);
72
+ }
73
+ export { Vector3D, SpotLabel, };
74
+ export * from './src/primitives/';