You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
After many attempts to resolve this I keep getting the error Error: Vertices v1 and v2 should be different when trying to render a SVG from an OBJ loaded. The error seem to come from the Halfedge package
When debugging further, it seemed the safeguard was checking two vertices with the same id? That didn't sound right, and maybe explains why removing duplicate verts didn't make it
This is more or less what Im doing (the different passes are here for testing, I havent got it to work yet)
private renderToSvg = (outlines: THREE.Group) => {
const meshes = new Array<SVGMesh>()
outlines.traverse(obj => {
if ((obj as THREE.Mesh).isMesh) {
let positions = obj.geometry.attributes.position.array
positions = new Float32Array(removeDuplicateVertices(positions))
obj.geometry.setAttribute(
"position",
new THREE.BufferAttribute(positions, 3)
)
obj.geometry.setDrawRange(0, positions.length)
obj.updateMatrix()
meshes.push(new SVGMesh(obj))
}
})
const renderer = new SVGRenderer()
const fillPass = new FillPass()
const singularityPass = new SingularityPointPass()
const visibleContourPass = new VisibleChainPass()
const hiddenContourPass = new HiddenChainPass()
renderer.addPass(fillPass)
renderer.addPass(visibleContourPass)
renderer.addPass(hiddenContourPass)
renderer.addPass(singularityPass)
renderer.viewmap.options.ignoreVisibility = false
renderer.viewmap.options.updateMeshes = true
// Get the SVG
renderer
.generateSVG(meshes, camera, { w: 1000, h: 1000 })
.then(svg => {
SVGRenderer.exportSVG(svg, "scene", { prettify: true })
})
}
private removeDuplicateVertices(vertices) {
var positionLookup = []
var final = []
vertices.forEach((pos, i) => {
if (i % 3 === 0) {
const str = `${pos}, ${pos + 1}, ${pos + 2}`
if (positionLookup.some(p => p === str)) return
positionLookup.push(str)
final.push(pos)
final.push(pos + 1)
final.push(pos + 2)
}
})
return final
}
The text was updated successfully, but these errors were encountered:
antoinemacia
changed the title
Vertices v1 and v2 should be different (though vertice deduped?)
Vertices v1 and v2 should be different (though vertices deduped?)
May 31, 2023
Hello hello!
After many attempts to resolve this I keep getting the error
Error: Vertices v1 and v2 should be different
when trying to render a SVG from an OBJ loaded. The error seem to come from the Halfedge packageWhat I've tried
When debugging further, it seemed the safeguard was checking two vertices with the same id? That didn't sound right, and maybe explains why removing duplicate verts didn't make it
This is more or less what Im doing (the different passes are here for testing, I havent got it to work yet)
Any suggestions welcome 😄 the potentially offending OBJ Im trying to render from the top is this one: https://drive.google.com/file/d/1lJai_bLgkGG8ZkIQi2q57x236drecOrn/view?usp=sharing
The text was updated successfully, but these errors were encountered: