Skip to content

Details about runtime errors #296

Description

@0xorial

I am trying to write a simple function that calculates area of a polygon. I tried a bunch of options but they all fail at BRepBuilderAPI_MakeFace::Add. My latest code is this:

        const pnts = []
        for (const point of points) {
            const pnt = new opencascade.gp_Pnt_3(point.x, point.y, 0)
            pnts.push(pnt)
        }

        const edges = []
        for (let i = 0; i < pnts.length; i++) {
            const start = pnts[i]
            const end = pnts[(i + 1) % pnts.length]
            const edge = new opencascade.BRepLib_MakeEdge_3(start, end)
            edges.push(edge.Edge())
        }

        const edge = new opencascade.BRepLib_MakeEdge_3(pnts[pnts.length - 1], pnts[0])
        edges.push(edge.Edge())

        const wireBuilder = new opencascade.BRepBuilderAPI_MakeWire_1()
        edges.forEach(edge => wireBuilder.Add_1(edge))
    
        const wire = wireBuilder.Wire()

        const faceBuilder = new opencascade.BRepBuilderAPI_MakeFace_1()

        faceBuilder.Add(wire)

        const face = faceBuilder.Face()

        const props = new opencascade.GProp_GProps_1()
        to_delete.push(props)
        opencascade.BRepGProp.SurfaceProperties_1(face, props, true, true)
        const area = props.Mass()
        return Math.abs(area)
  1. Is there any way to get more informative stacktrace? One I have now only contains wasm addresses. I saw a screenshot somewhere that included original function names, it would be already helpfule if I could at least have an idea of C++ code that was called.
  2. The error simply says "18967720". Does that map to anything? How can I get something more meaningful out of it?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions