UNPKG

@sohale/implisolid

Version:

A Solid Modelling Kernel in Javascript based on Implicit Surfaces, for MP5 file format

179 lines (129 loc) 6.65 kB
Core model of the Designer: mainModel : cModel Shape3D AbstractShape3D Cylinder3D GenericImplicitObject root.js shape.js C++-JS interface: Upderstandable by The designer's JS code C++ ImpliSolid main job: polygonisation (an API) - determining implicit funcitons: (1) as unique functions or (2) as composition of functions. -- Can we turn (2) into (1). Yes there are specific solutions (see below i001). - polygonisation algorithm (for now OB02) - Modelling techniques (minor): - Will move into (as a) Web Worker Has two interfaces (API): (a set of functions on both sides: C++ & JS) - Web Worker-based interface - Direct interface On designer we only keep the tree. The actual function is directly accessible through calls on C++ funcitons. As a result of separateion, tree & iimplicit-funcitons. Thre tree is shared with C++, not the other way. It does two jobs: evaluation of implicit funciton evaluation, and polygonisation. We spent over a month in February 2016 to select the right algorithm ad approach. Two main papers were used: A review (by ...) and an algorithm (Ohtake & Belyaev 2002 [OB02]). The polygonisation (as of in December 2016) needs to be completed (third step in OB02). Designer main job: display Open source plan for ImpliSolid: * Need three libraries: - npm library - C++ library - Python library * Documenting what we want (explaining & sharing). These ideas are in API. * Needs documentation (implementation). * . Need Modelling techniques Compl [i001] Solutions to convert composition of implicit funciotns into a single implicit funciotn for perfornmance. - Using symbolic math (evaluating equations given by the user in run-time): - JavaSCript-based - C++-bcased. It needs a library that can do automatic differentiation (Checkout "Auto Diff" on wikipedia). The differentiation has three approaches: - Numerical differentiation (requires at least evaluations of 9 points) - Symbolic differentiation (can produce large equaitons: Sympy, or a suitable C++ library.) - "Auto-Diff" (most efficient) such as Theano. It is a more more efficient Symbolic. - Using compiling. Another solution is to use run-time compiling. [i002] Local versus complete re-polygonisation: - Example: In free-form objects it has to respond fast. - UPDATE_A_LOCAL_REGION(OBJECT, REGION(BOX)). This solutionan be used for CSG as well. - It is possible to do this in ht algorithm of OB02. - This requirement is essential and has to be done in future. e.g. for the quick update of free-form object. Modelling Techniques on C++ side: User story: Steps after "new object": Thre are three representations. - tree (Shape3D) is added in designer's code model (tree represenation) - each tree has another representation which is used for storing the object, and saving the MP5 format. It is a "javascript dictionary". Which can be stored in text format using json (this is called the mp5 object). The same format is used in multiple programs: (inter-operability): Slicer, C++ implicit function (composition of functions from the given tree), database, collaboration, in Undo (history), Web Worker. They all use the same json format. (For the whole model tree i.e. mp5 file, or a part of it.). - polygnosaiton request sent to C++ (data structure inside the algorithm) - polygon is deplayed by creating THREEJS Mesh objects on designer. (Mesh representation) - In future on C++ 1. - implicit function 2. - polygon (also the tree which is directly received from the designer) 3. - Object3D (objects with user operations). user operations = available actions. (which is different/separate to implicit functions). [i003]: The name "primitive" has two meanings can cause confusion. Primitive on designer versus primitive on C++ ImpliSolid: - "Reusable object" or "Standard object" - a single (primitive) inplicit function. [i004]: Feature: User can specify his own formula equation as a shape or even a primitive. Solutions discussed in [i001]. The main reason for choosing implicit was not becaseu you can represent a new object y a formula. The main reason is to use Solid modelling using Volume representaiton (F-Rep). Not Boundary-representaion. Such as Open Cascade, It is motivated by our desire to combine different appraochs (from user's point of view): - Solid modeling of Solidworks - Rhino - Z-brush Modelling techniques need to be provided to provide the above three styles of modelling. We need curved surfaces (based on algebraic formulas with customisable parameters, not triangles or finite-element approaximations). Like vector graphics. When we slice, the curvature is not lost. Certain poerations are easy to implement. Such as: - Shell - CSG operations. - Specific models: Free-form, Sweep, etc - Distance between objects - Collision and tangents (magnet) - Blending for fillet, chamfer, etc. - New possibilities such as Twist, etc. - Combining everything (complex object design). - truncation error and other numerical instabilities will not harm. The operations (on modelling technique) will be very easy to solve. - instabilities : - polygonisation Certain things will be difficult in Implicit Modelling: - Clean representation on screen. - Detailed view of (details of) objects. - .. - .. Background software: -Blob? Feature: User should be able to define the resolution. - Already implemented on C+_+ side using the mc_properties (i.e. polygonisation_settings json). - Needs to be implemented on Designer side. - See [i005] [i005]: - Challenge: improve polygonisation at a local region according to what specified by user. - See function `get_latest_vf()` in simplisolid_main.js - This goes well with the desired feature about local (regions) of quality / material on Slicer side. - Includes the challenge of thin walls. - Requires mathematical understanfing. + modifying the OB02 paper's algorithm and improving it. A list of suggestions is available by SS. Main files: - mcc2.cpp - implisolid_main.js & its web-worker version LiveBufferGeometry79 Putting the normals into threejs: -base dongradients on C++ side SDF: curating formulas analytically special much faster root finding (for OB02 & RayTacing) see [i06] challenging for certain shapes (such as Ellipsoids) [i006] What primitives to choose? - see SDF - - . Facilitation of Open-Source: - Easty way to visualise