void buildMansardShape(const utymap::meshing::Polygon& polygon, ClipperLib::Path& offsetShape, std::size_t index) { std::reverse(offsetShape.begin(), offsetShape.end()); // build top utymap::meshing::Polygon topShape(offsetShape.size(), 0); std::vector<utymap::meshing::Vector2> topShapeVertices; topShapeVertices.reserve(offsetShape.size()); for (const auto& p : offsetShape) { topShapeVertices.push_back(utymap::meshing::Vector2(p.X / Scale, p.Y/ Scale)); } topShape.addContour(topShapeVertices); auto topOptions = utymap::meshing::MeshBuilder::Options{ 0, 0, colorNoiseFreq_, height_, getColorGradient(), minHeight_ }; builderContext_.meshBuilder.addPolygon(meshContext_.mesh, topShape, topOptions); // build sides auto sideOptions = utymap::meshing::MeshBuilder::Options { 0, 0, colorNoiseFreq_, 0, getColorGradient(), 0 }; double topHeight = minHeight_ + height_; auto size = polygon.points.size(); for (std::size_t i = 0; i < size; i += 2) { auto topIndex = i; auto bottomIndex = (index + i) % size; auto nextTopIndex = (i + 2) % size; auto nextBottomIndex = (index + i + 2) % size; auto v0 = utymap::meshing::Vector3(polygon.points[bottomIndex], minHeight_, polygon.points[bottomIndex + 1]); auto v1 = utymap::meshing::Vector3(polygon.points[nextBottomIndex], minHeight_, polygon.points[nextBottomIndex + 1]); auto v2 = utymap::meshing::Vector3(topShape.points[nextTopIndex], topHeight, topShape.points[nextTopIndex + 1]); auto v3 = utymap::meshing::Vector3(topShape.points[topIndex], topHeight, topShape.points[topIndex + 1]); builderContext_.meshBuilder.addTriangle(meshContext_.mesh, v0, v2, v3, sideOptions, false); builderContext_.meshBuilder.addTriangle(meshContext_.mesh, v2, v0, v1, sideOptions, false); } }
void MaskOutputsLayer<Dtype>::Reshape(const vector<Blob<Dtype>*>& bottom, const vector<Blob<Dtype>*>& top) { vector<int> topShape(2); topShape[0] = bottom[0]->shape()[0]; topShape[1] = kernel_size_; top[0]->Reshape(topShape); }