int main(int argc, char** argv) { IfcHierarchyHelper file; IfcSchema::IfcBuildingElementProxy* product = new IfcSchema::IfcBuildingElementProxy( guid(), 0, S("Blender's Suzanne"), null, null, 0, 0, null, null); file.addBuildingProduct(product); product->setOwnerHistory(file.getSingle<IfcSchema::IfcOwnerHistory>()); product->setObjectPlacement(file.addLocalPlacement()); IfcSchema::IfcRepresentation::list::ptr reps (new IfcSchema::IfcRepresentation::list); IfcSchema::IfcRepresentationItem::list::ptr items (new IfcSchema::IfcRepresentationItem::list); std::vector< std::vector< double > > vertices_vector = create_vector_from_array(vertices, sizeof(vertices) / sizeof(vertices[0])); std::vector< std::vector< int > > indices_vector = create_vector_from_array(indices, sizeof(indices) / sizeof(indices[0])); IfcSchema::IfcCartesianPointList3D* coordinates = new IfcSchema::IfcCartesianPointList3D(vertices_vector); IfcSchema::IfcTriangulatedFaceSet* faceset = new IfcSchema::IfcTriangulatedFaceSet(coordinates, null, null, indices_vector, null); items->push(faceset); IfcSchema::IfcShapeRepresentation* rep = new IfcSchema::IfcShapeRepresentation( file.getRepresentationContext("Model"), S("Body"), S("SurfaceModel"), items); reps->push(rep); IfcSchema::IfcProductDefinitionShape* shape = new IfcSchema::IfcProductDefinitionShape(0, 0, reps); file.addEntity(shape); product->setRepresentation(shape); const std::string filename = "tesselated_faceset.ifc"; file.header().file_name().name(filename); std::ofstream f(filename.c_str()); f << file; }
/******************************************************************************* * d_filter_t create_filter(int order, float dt, float* num, float* den) * * Allocate memory for a filter of specified order & fill with transfer * function constants. Use enable_saturation immediately after this if you want * to enable automatic saturation. *******************************************************************************/ d_filter_t create_filter(int order, float dt, float* num, float* den){ d_filter_t filter; if(order<1){ printf("ERROR: order must be >=1\n"); return filter; } filter.order = order; filter.prescaler = 1; filter.newest_input = 0; filter.newest_output = 0; filter.saturation_en = 0; filter.saturation_min = 0; filter.saturation_max = 0; filter.saturation_flag = 0; filter.numerator = create_vector_from_array(order+1, num); filter.denominator = create_vector_from_array(order+1, den); filter.in_buf = create_ring_buf(order+1); filter.out_buf = create_ring_buf(order+1); filter.initialized = 1; return filter; }