///////////////////////////////////////////////////////////////////////////////// // // Copyright (C) 2017 Statoil ASA // // ResInsight is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY // WARRANTY; without even the implied warranty of MERCHANTABILITY or // FITNESS FOR A PARTICULAR PURPOSE. // // See the GNU General Public License at // for more details. // ///////////////////////////////////////////////////////////////////////////////// #include "RimFracture.h" #include "RigFracture.h" #include "RigTesselatorTools.h" #include "RimFractureDefinition.h" CAF_PDM_XML_ABSTRACT_SOURCE_INIT(RimFracture, "Fracture"); //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- RimFracture::RimFracture(void) { CAF_PDM_InitObject("Fracture", "", "", ""); m_rigFracture = new RigFracture; } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- RimFracture::~RimFracture() { } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- const std::vector& RimFracture::polygonIndices() const { return m_rigFracture->polygonIndices(); } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- const std::vector& RimFracture::nodeCoords() const { return m_rigFracture->nodeCoords(); } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- void RimFracture::computeGeometry() { std::vector nodeCoords; std::vector polygonIndices; cvf::Vec3d center = centerPointForFracture(); RimFractureDefinition* fractureDef = attachedFractureDefinition(); if (fractureDef && !center.isUndefined()) { RigEllipsisTesselator tesselator(20); float a = fractureDef->height / 2.0f; float b = fractureDef->halfLength; tesselator.tesselateEllipsis(a, b, &polygonIndices, &nodeCoords); } // TODO: Modify coords by fracture center and orientation m_rigFracture->setGeometry(polygonIndices, nodeCoords); } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- bool RimFracture::hasValidGeometry() const { return (nodeCoords().size() > 0 && polygonIndices().size() > 0); }