mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#8186 Add vec3 tools used to change sign of z component
This commit is contained in:
parent
ce6ea17cd2
commit
cb26131102
@ -46,6 +46,7 @@ set(SOURCE_GROUP_HEADER_FILES
|
||||
${CMAKE_CURRENT_LIST_DIR}/RiaWellLogUnitTools.inl
|
||||
${CMAKE_CURRENT_LIST_DIR}/RiaTimeTTools.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RiaValidRegExpValidator.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RiaVec3Tools.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RiaEnsembleNameTools.h
|
||||
)
|
||||
|
||||
@ -91,6 +92,7 @@ set(SOURCE_GROUP_SOURCE_FILES
|
||||
${CMAKE_CURRENT_LIST_DIR}/RiaTimeTTools.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RiaValidRegExpValidator.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RiaEnsembleNameTools.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RiaVec3Tools.cpp
|
||||
)
|
||||
|
||||
list(APPEND CODE_SOURCE_FILES ${SOURCE_GROUP_SOURCE_FILES})
|
||||
|
67
ApplicationLibCode/Application/Tools/RiaVec3Tools.cpp
Normal file
67
ApplicationLibCode/Application/Tools/RiaVec3Tools.cpp
Normal file
@ -0,0 +1,67 @@
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2021- Equinor 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 <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "RiaVec3Tools.h"
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
cvf::Vec3d RiaVec3Tools::invertZSign( const cvf::Vec3d& source )
|
||||
{
|
||||
return { source.x(), source.y(), -source.z() };
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<cvf::Vec3d> RiaVec3Tools::invertZSign( const std::vector<cvf::Vec3d>& source )
|
||||
{
|
||||
std::vector<cvf::Vec3d> points;
|
||||
|
||||
points.reserve( source.size() );
|
||||
for ( const auto& p : source )
|
||||
{
|
||||
points.emplace_back( invertZSign( p ) );
|
||||
}
|
||||
|
||||
return points;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
cvf::Vec3f RiaVec3Tools::invertZSign( const cvf::Vec3f& source )
|
||||
{
|
||||
return { source.x(), source.y(), -source.z() };
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<cvf::Vec3f> RiaVec3Tools::invertZSign( const std::vector<cvf::Vec3f>& source )
|
||||
{
|
||||
std::vector<cvf::Vec3f> points;
|
||||
|
||||
points.reserve( source.size() );
|
||||
for ( const auto& p : source )
|
||||
{
|
||||
points.emplace_back( invertZSign( p ) );
|
||||
}
|
||||
|
||||
return points;
|
||||
}
|
36
ApplicationLibCode/Application/Tools/RiaVec3Tools.h
Normal file
36
ApplicationLibCode/Application/Tools/RiaVec3Tools.h
Normal file
@ -0,0 +1,36 @@
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2021- Equinor 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 <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "cvfVector3.h"
|
||||
|
||||
#include <vector>
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
//==================================================================================================
|
||||
class RiaVec3Tools
|
||||
{
|
||||
public:
|
||||
static cvf::Vec3d invertZSign( const cvf::Vec3d& source );
|
||||
static std::vector<cvf::Vec3d> invertZSign( const std::vector<cvf::Vec3d>& source );
|
||||
|
||||
static cvf::Vec3f invertZSign( const cvf::Vec3f& source );
|
||||
static std::vector<cvf::Vec3f> invertZSign( const std::vector<cvf::Vec3f>& source );
|
||||
};
|
Loading…
Reference in New Issue
Block a user