csg

After using the threeBSP method, the created spheres are not smooth

坚强是说给别人听的谎言 提交于 2021-02-10 16:22:01
问题 I'm trying to change the number of segments of the sphere, but I can't cut it if I have reached the 45 limit, and there's no other way to make the sphere a little smoother. var result; var sphereG = new THREE.SphereGeometry( 115, 45, 45 ); var sphereM = new THREE.MeshPhongMaterial({color:"#fff"} ); var sphere = new THREE.Mesh(sphereG,sphereM); var polyhedronG = new THREE.Geometry(); polyhedronG.vertices.push( new THREE.Vector3(-200,200,-200), //A 0 new THREE.Vector3(-200,-200,200), //B 1 new

Subtracting Geometry in Three.js (or really, 3D programming in general)

吃可爱长大的小学妹 提交于 2021-01-29 06:50:22
问题 I'm currently working on a small project with which I need to subtract a rectangular area of a cube on mousemove (think, an indented area for placing a door on a house). The 'door' would be 'placed' on click, but would need to be 'visualized' while the user is deciding its location; in reality, nothing changes except the fact that the user is no longer moving it around. The issue here is finding an efficient way of allowing a user to move the door around, while it interacts and modifies the

intersecting meshes results to mesh with wholes

梦想的初衷 提交于 2021-01-28 06:22:36
问题 I am using THREE and I am trying to intersect a box mesh with a custom geometry I am creating and converting it to geometry using : const g = new THREE.Geometry().fromBufferGeometry(shape3d) I aim to add faces to the custom geometry, that is why I do that. So I expect to get back from the intersection my custom geometry + polygons that the box has. I get that indeed, though I get also some holes as you can see in the below image : I used many csg versions that are out there, the manthrax one,

How do I construct a hollow cylinder in Three.js

随声附和 提交于 2020-01-01 12:32:16
问题 I'm having difficulties constructing a hollow cylinder in Three.js. Should I go and construct it using CSG or by stitching the vertices together? 回答1: This solution uses ChandlerPrall's ThreeCSG.js project: http://github.com/chandlerprall/ThreeCSG (For now, I recommend using the experimental version that supports materials - the uv branch - http://github.com/chandlerprall/ThreeCSG/tree/uvs) Here's the code you will need: // Cylinder constructor parameters: // radiusAtTop, radiusAtBottom,

基于HTML5 Canvas的CSG构造实体几何书架

会有一股神秘感。 提交于 2019-12-23 13:46:10
【推荐】2019 Java 开发者跳槽指南.pdf(吐血整理) >>> CSG 构造实体几何这个概念在工业水利水电施工上、游戏上已经有很多人使用了,最简单的实体表示叫作体元,通常是形状简单的物体,如立方体、圆柱体、棱柱、棱锥、球体、圆锥等。根据每个软件包的不同这些体元也有所不同,在一些软件包中可以使用弯曲的物体进行 CSG 处理,在另外一些软件包中则不支持这些功能。构造物体就是将体元根据集合论的布尔逻辑组合在一起,这些运算包括:并集、交集以及补集。我们一般可以用 CSG 来将简单的模型合在一起生成复杂的模型,这样在构造模型的时候会省很多力。 HT 中的 ht.CSGNode 图元类型就是参考 CSG 封装的一个函数,ht.CSGNode 继承于 ht.Node,当 style 的 shape3d 属性为空时显示为六面体效果,CSGNode如果通过 setHost 吸附到 宿主 CSGNode 或 CSGShape 后,宿主 CSGNode 或 CSGShape 可与吸附的CSGNode图元进行CSG的组合建模。详情请参考 HT for Web 建模手册 CSGNode 章节 。这里我用 CSG 的概念写了一个例子,让大家能更好地理解这个概念。 本例 Demo 地址: http://hightopo.com/guide/guide/plugin/modeling/examples

基于HT的CSG功能构建HTML5的3D书架

杀马特。学长 韩版系。学妹 提交于 2019-12-23 13:41:31
【推荐】2019 Java 开发者跳槽指南.pdf(吐血整理) >>> 构造实体几何 CSG 全称 Constructive solid geometry ,是3D计算机图形学中构建模型的常用技术,可通过合并Union、相减Subtraction和相交Intersction的三种取集的逻辑运算,将立方体、圆柱体和棱柱等简单的基础模型,嵌套组合成更复杂三维模型。 CSG的算法这些年来已有各种语言平台版本实现,C++版主流的是 http://opencsg.org/ 已有众多基于该开源类库的应用案例,JavaScript语言较早版实现 http://evanw.github.io/csg.js/ 影响较广,很多其他js衍生版都是基于该版本进行改进完善,包括Java版的实现 https://github.com/miho/JCSG ,可参考基于JavaFX的3D打印IDE https://github.com/miho/JFXScad ,提起JavaFX视乎这些年完全消失在程序员视野毫无声息,但还是有一群拥护者持续在使用着如今地位有点尴尬的JavaFX。 回到我们今天要搞的3D书架例子,我们将基于 HT for Web 的3D引擎来实现, HT 已经内置了CSG功能的模型封装,我们通过构建CSGNode图元对象,该类型图元可对Host吸附的图元进行CSG技术的合集、并集和补集的三种操作

3D Boolean operations with Three CSG

半腔热情 提交于 2019-12-18 18:31:16
问题 Following the example here: http://learningthreejs.com/blog/2011/12/10/constructive-solid-geometry-with-csg-js/ And using Three.js with https://github.com/chandlerprall/ThreeCSG, I'm trying to do 3D boolean operations on nodes from the model. Like for example if I have a wall with a window, I want to do invert() on that to get just the window. I have a function that returns all the vertices of the polygons of a node, here's an example of vertices of an object without holes https://pastebin

Controlling the scaling of custom geometries in Three.js

二次信任 提交于 2019-12-11 16:04:47
问题 I have a custom object which is a subtraction of two meshes. This subtraction creates a frame-like object. createFrame (x, y, z) { const frameMesh = new THREE.Mesh(new THREE.BoxGeometry(1,1,1)); frameMesh.scale.set(x, y, z); const smallerFrameMesh = frameMesh.clone() smallerFrameMesh.scale.set(x - 4, y - 4, z); // subtraction const frameGeometry = fromCSG(toCSG(frameGeometry).subtract(toCSG(smallerFrameMesh))); const frame = new THREE.Mesh(frameGeometry, new THREE.MeshStandardMaterial

Suggestion on how to create a window over a wall

心已入冬 提交于 2019-12-11 15:14:18
问题 I am working on a three.js application where I have to create a building structure (all on ground floor), the height, width, length will be specified by user. User can change wall and roof color (which are applied using texture, as I have images for each color with some texture). They can also add any accessory on a selected wall (like a window or a door), which can be then dragged and dropped on that same selected wall. After deciding where they want to put the window (for eg.) they will

How to convert a MeshView to a CSG object using JCSG library in JavaFX

走远了吗. 提交于 2019-12-10 07:04:21
问题 I'm using the JCSG library for JavaFX. I have some MeshView objects that I want to convert them into CSG objects, is there a way to achieve this? 回答1: The easiest way to combine a javafx.scene.shape.Mesh object with a CSG one, providing you have a TriangleMesh is converting the triangular faces to polygons ( eu.mihosoft.vrl.v3d.Polygon ). Once you have a CSG object you can perform the regular operations on it, and then you can export it back to a MeshView for instance. The problem with