BOOL CXaraFileRectangle::WriteRectangleSimpleRounded(BaseCamelotFilter * pFilter, NodeRegularShape * pShape) { BOOL ok; CamelotFileRecord Rec(pFilter,TAG_RECTANGLE_SIMPLE_ROUNDED, TAG_RECTANGLE_SIMPLE_ROUNDED_SIZE); ok = Rec.Init(); if (ok) ok = Rec.WriteCoord(GetCentrePoint(pShape)); if (ok) ok = Rec.WriteINT32(GetWidth(pShape)); if (ok) ok = Rec.WriteINT32(GetHeight(pShape)); if (ok) ok = Rec.WriteDOUBLE(GetCurvature(pShape)); if (ok) ok = pFilter->Write(&Rec); return ok; }
BOOL CXaraFileRectangle::WriteRectangleComplexRounded(BaseCamelotFilter * pFilter, NodeRegularShape * pShape) { BOOL ok; CamelotFileRecord Rec(pFilter,TAG_RECTANGLE_COMPLEX_ROUNDED, TAG_RECTANGLE_COMPLEX_ROUNDED_SIZE); ok = Rec.Init(); if (ok) ok = Rec.WriteCoord(GetCentrePoint(pShape)); if (ok) ok = Rec.WriteCoordTrans(GetMajorAxis(pShape),0,0); if (ok) ok = Rec.WriteCoordTrans(GetMinorAxis(pShape),0,0); if (ok) ok = Rec.WriteDOUBLE(GetCurvature(pShape)); if (ok) ok = pFilter->Write(&Rec); return ok; }
BOOL CXaraFileRectangle::WriteRectangleComplexRoundedReformed(BaseCamelotFilter * pFilter, NodeRegularShape * pShape) { BOOL ok; CamelotFileRecord Rec(pFilter,TAG_RECTANGLE_COMPLEX_ROUNDED_REFORMED, TAG_RECTANGLE_COMPLEX_ROUNDED_REFORMED_SIZE); ok = Rec.Init(); if (ok) ok = Rec.WriteCoordTrans(GetUTMajorAxis(pShape),0,0); if (ok) ok = Rec.WriteCoordTrans(GetUTMinorAxis(pShape),0,0); if (ok) ok = Rec.WriteMatrix(GetTransformMatrix(pShape)); if (ok) ok = Rec.WriteDOUBLE(GetCurvature(pShape)); if (ok) ok = Rec.WritePath(GetEdgePath(pShape)); if (ok) ok = pFilter->Write(&Rec); return ok; }
BOOL CXaraFilePolygon::WritePolygonComplexRounded(BaseCamelotFilter * pFilter, NodeRegularShape * pShape) { BOOL ok; CamelotFileRecord Rec(pFilter,TAG_POLYGON_COMPLEX_ROUNDED, TAG_POLYGON_COMPLEX_ROUNDED_SIZE); ok = Rec.Init(); if (ok) ok = Rec.WriteUINT16(GetNumberOfSides(pShape)); if (ok) ok = Rec.WriteCoord(GetCentrePoint(pShape)); if (ok) ok = Rec.WriteCoordTrans(GetMajorAxis(pShape),0,0); if (ok) ok = Rec.WriteCoordTrans(GetMinorAxis(pShape),0,0); if (ok) ok = Rec.WriteDOUBLE(GetCurvature(pShape)); if (ok) ok = pFilter->Write(&Rec); return ok; }
void Implicit::Update() { if (mVisualizationMode == Curvature) { if(typeid(*mMesh) == typeid(SimpleMesh)) { SimpleMesh * ptr = static_cast<SimpleMesh*>(mMesh); std::vector<SimpleMesh::Vertex>& verts = ptr->GetVerts(); Matrix4x4<float> M = GetTransform().Transpose(); // Compute curvature of implicit geometry and assign to the vertex property for(unsigned int i=0; i < verts.size(); i++){ const Vector3<float> vObject = verts.at(i).pos; // Transform vertex position to world space Vector4<float> vWorld = GetTransform() * Vector4<float>(vObject[0],vObject[1],vObject[2],1); // Get curvature in world space verts.at(i).curvature = GetCurvature(vWorld[0], vWorld[1], vWorld[2]); // Get gradient in world space (used for lighting) Vector3<float> nWorld = GetGradient(vWorld[0], vWorld[1], vWorld[2]); // Transform gradient to object space Vector4<float> nObject = M * Vector4<float>(nWorld[0],nWorld[1],nWorld[2],0); verts.at(i).normal = Vector3<float>(nObject[0], nObject[1], nObject[2]).Normalize(); } ptr->mAutoMinMax = mAutoMinMax; ptr->mMinCMap = mMinCMap; ptr->mMaxCMap = mMaxCMap; ptr->SetVisualizationMode(Mesh::CurvatureVertex); ptr->Update(); } else { std::cerr << "No Curvature visualization mode implemented for mesh type: " << typeid(*mMesh).name() << std::endl; } } }