------------------------------------------------------------------------------------------------
| 105 | |
| 106 | // ------------------------------------------------------------------------------------------------ |
| 107 | void ProcessParametrizedProfile(const Schema_2x3::IfcParameterizedProfileDef& def, |
| 108 | TempMesh& meshout, |
| 109 | ConversionData& conv) { |
| 110 | if(const Schema_2x3::IfcRectangleProfileDef* const cprofile = def.ToPtr<Schema_2x3::IfcRectangleProfileDef>()) { |
| 111 | const IfcFloat x = cprofile->XDim*0.5f, y = cprofile->YDim*0.5f; |
| 112 | |
| 113 | meshout.mVerts.reserve(meshout.mVerts.size()+4); |
| 114 | meshout.mVerts.emplace_back( x, y, 0.f ); |
| 115 | meshout.mVerts.emplace_back(-x, y, 0.f ); |
| 116 | meshout.mVerts.emplace_back(-x,-y, 0.f ); |
| 117 | meshout.mVerts.emplace_back( x,-y, 0.f ); |
| 118 | meshout.mVertcnt.push_back(4); |
| 119 | } else if( const Schema_2x3::IfcCircleProfileDef* const circle = def.ToPtr<Schema_2x3::IfcCircleProfileDef>()) { |
| 120 | if(def.ToPtr<Schema_2x3::IfcCircleHollowProfileDef>()) { |
| 121 | // TODO |
| 122 | } |
| 123 | const size_t segments = conv.settings.cylindricalTessellation; |
| 124 | const IfcFloat delta = AI_MATH_TWO_PI_F/segments, radius = circle->Radius; |
| 125 | |
| 126 | meshout.mVerts.reserve(segments); |
| 127 | |
| 128 | IfcFloat angle = 0.f; |
| 129 | for(size_t i = 0; i < segments; ++i, angle += delta) { |
| 130 | meshout.mVerts.emplace_back( std::cos(angle)*radius, std::sin(angle)*radius, 0.f ); |
| 131 | } |
| 132 | |
| 133 | meshout.mVertcnt.push_back(static_cast<unsigned int>(segments)); |
| 134 | } else if( const Schema_2x3::IfcIShapeProfileDef* const ishape = def.ToPtr<Schema_2x3::IfcIShapeProfileDef>()) { |
| 135 | // construct simplified IBeam shape |
| 136 | const IfcFloat offset = (ishape->OverallWidth - ishape->WebThickness) / 2; |
| 137 | const IfcFloat inner_height = ishape->OverallDepth - ishape->FlangeThickness * 2; |
| 138 | |
| 139 | meshout.mVerts.reserve(12); |
| 140 | meshout.mVerts.emplace_back(0,0,0); |
| 141 | meshout.mVerts.emplace_back(0,ishape->FlangeThickness,0); |
| 142 | meshout.mVerts.emplace_back(offset,ishape->FlangeThickness,0); |
| 143 | meshout.mVerts.emplace_back(offset,ishape->FlangeThickness + inner_height,0); |
| 144 | meshout.mVerts.emplace_back(0,ishape->FlangeThickness + inner_height,0); |
| 145 | meshout.mVerts.emplace_back(0,ishape->OverallDepth,0); |
| 146 | meshout.mVerts.emplace_back(ishape->OverallWidth,ishape->OverallDepth,0); |
| 147 | meshout.mVerts.emplace_back(ishape->OverallWidth,ishape->FlangeThickness + inner_height,0); |
| 148 | meshout.mVerts.emplace_back(offset+ishape->WebThickness,ishape->FlangeThickness + inner_height,0); |
| 149 | meshout.mVerts.emplace_back(offset+ishape->WebThickness,ishape->FlangeThickness,0); |
| 150 | meshout.mVerts.emplace_back(ishape->OverallWidth,ishape->FlangeThickness,0); |
| 151 | meshout.mVerts.emplace_back(ishape->OverallWidth,0,0); |
| 152 | |
| 153 | meshout.mVertcnt.push_back(12); |
| 154 | } else { |
| 155 | IFCImporter::LogWarn("skipping unknown IfcParameterizedProfileDef entity, type is ", def.GetClassName()); |
| 156 | return; |
| 157 | } |
| 158 | |
| 159 | IfcMatrix4 trafo; |
| 160 | ConvertAxisPlacement(trafo, *def.Position); |
| 161 | meshout.Transform(trafo); |
| 162 | } |
| 163 | |
| 164 | // ------------------------------------------------------------------------------------------------ |
no test coverage detected