ofxBox2d triangulation of a static body (simple example of bug)

I have posted on this before, but to no avail. Sorry for slightly repeating myself but I have tried to figure this out and I haven’t been able to. I am probably not understanding something in box2d.

I looked deeper into the issue and I wrote a very simplified example to highlight the issue. In my code I simply create a rectangle. I triangulate it and then I add it to a box2d world. If I define the object as a dynamic object (density > 0) it is reacting to the walls and objects within the scene:

If I declare it as a static (density=0) then this is what is displayed when I draw the shape:

Basically it’s the setPhysics line that makes all the difference between the two scenarios.

Why is the triangulation affected and how could I properly insert the triangles that emerge from it as static objects without the aforementioned issues? I need the object to be static so that the box2d engine does not try to move it when others hit it, affect it by gravity etc.

#include "ofApp.h"

//--------------------------------------------------------------
void ofApp::setup()
{
    // Box2d
    box2d.init();
    box2d.createGround();
    box2d.setFPS(30.0);
}

//--------------------------------------------------------------
void ofApp::update()
{
    shape.clear();

    //A simple rectangle
    shape.addVertex(ofPoint(mouseX, mouseY));
    shape.addVertex(ofPoint(mouseX+0, mouseY+200));
    shape.addVertex(ofPoint(mouseX+200, mouseY+200));
    shape.addVertex(ofPoint(mouseX+200, mouseY));

    shape.simplify();
    ofPolyline outline = shape;
    ofPolyline resampled = shape.getResampledBySpacing(45);

    vector <TriangleShape> tris;
    tris = triangulatePolygonWithOutline(resampled, outline);

    polyShapes.clear();

    // now loop through all the triangles and make a box2d triangle
    for (int i=0; i<tris.size(); i++)
    {
          ofPtr<ofxBox2dPolygon> triangle = ofPtr<ofxBox2dPolygon>(new ofxBox2dPolygon);
          triangle.get()->addTriangle(tris[i].a, tris[i].b, tris[i].c);
          triangle.get()->setPhysics(1, 0, 0); //density, bounce, friction
          triangle.get()->create(box2d.getWorld());
          //triangle.get()->body->SetType(b2_staticBody);
          polyShapes.push_back(triangle);
    }

    box2d.update();
}

//--------------------------------------------------------------
void ofApp::draw()
{
    ofBackground(125);

    ofSetColor(255);
    ofNoFill();
    for (int i=0; i<polyShapes.size(); i++)
    {
        polyShapes[i].get()->draw();
        ofCircle(polyShapes[i].get()->getPosition(), 3);
    }
}

and here is the ofApp.h file:

#pragma once
#include "ofMain.h"
#include "ofxBox2d.h"

class ofApp : public ofBaseApp{

    public:
        void setup();
        void update();
        void draw();

        ofPolyline shape;
        vector <ofPtr<ofxBox2dPolygon> > polyShapes;
        ofxBox2d box2d;
};

If you’d like to test the code yourself here are the 2 files:
src.zip (1.3 KB)