Skip to content

Commit

Permalink
fixed bug in SBGATSphericalHarmo, SHARMLib and CMakeLists.txt
Browse files Browse the repository at this point in the history
  • Loading branch information
bbercovici committed Feb 19, 2019
1 parent 0e115a1 commit d86ff80
Show file tree
Hide file tree
Showing 6 changed files with 46 additions and 40 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ doxygen_script.sh
doc/
.add_license.sh
.LICENSE.hpp
./Tests/output/*
37 changes: 13 additions & 24 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,32 +16,16 @@ The SBGAT User's Wiki can be found [here](https://github.com/bbercovici/SBGAT/wi

### Mac users

[Homebrew](https://brew.sh/) can be used to install SBGAT's components and dependencies. Homebrew install options differ whether you want to use *SbgatGui* or just the core classes of *SbgatCore*. This is justified by *SbgatCore*'s dependency on *VTK*, as *VTK* needs to know whether it must be linked against *Qt* at build time.

#### With SbgatGui
[Homebrew](https://brew.sh/) can be used to install SBGAT's components and dependencies.

brew tap bbercovici/self
brew update
brew install vtk --with-qt
brew install vtk
brew install sbgat-core
brew install sbgat-gui

The *SbgatGui* executable will be simlinked to `/usr/local/bin` .

#### Without SbgatGui

brew tap bbercovici/self
brew update
brew install vtk
brew install sbgat-core

If you change your mind and decide you want the *SbgatGui* component, run:

brew uninstall sbgat-core
brew uninstall vtk

before reinstalling.

### Linux & Mac users

[Refer to the detailed installation instructions](https://github.com/bbercovici/SBGAT/wiki/2:-Compiling-and-installing-SBGAT-dependencies).
Expand Down Expand Up @@ -74,18 +58,25 @@ to apply the update (if any).

## Changelog

### [SBGAT 2.02.3](https://github.com/bbercovici/SBGAT/releases/tag/2.02.3)

#### Bug fixes
- Fixed bug in `SBGATSphericalHarmo` that could have caused the evaluation of the spherical harmonics over a non-barycented shape to be incorrect.
- Pushed fix to latest version of `SHARMLib` dependency to address the same issue
- Modified `CMakeLists.txt` in Tests to fix issue caused by a conflicting header being sometimes included by one of VTK's dependencies


### [SBGAT 2.02.2](https://github.com/bbercovici/SBGAT/releases/tag/2.02.2)

### New
- Shape models can now be modified from within SBGATGui, by selecting a vertex and applying a Gaussian interpolation of the vertex displacement to a neighborhood of arbitrary choice.
#### New
- Shape models can now be modified from within SBGATGui, by selecting a vertex and applying a Gaussian interpolation of the vertex displacement to a k-neighbor neighborhood.

### Improvements
#### Improvements
- Camera is now positioned at the correct distance from the targeted shape body upon loading
- Improved visual aspect of selected facet
- Improved visual aspect of loaded shapes

### Bug fixes:
#### Bug fixes:
- Fixed bug in SBGATGui that prevented proper alignment of the shape model with its principal axes

### [SBGAT 2.02.1](https://github.com/bbercovici/SBGAT/releases/tag/2.02.1)
Expand Down Expand Up @@ -124,15 +115,13 @@ to apply the update (if any).
### New:
- Facets can now be individually selected in `SbgatGui` by clicking on them. If the surface PGM of the selected shape is available, the results for the selected facet will be shown in the console


#### Improvements
- The `Set Shape Mapper` option was renamed to `Set Results Overlay`
- Several GUI minors bug fixes

### Bug fixes:
- Fixed bug in `SbgatCore` that was due to an unecessary rescaling of the computed potentials and accelerations within `SbgatCore::ComputeSurfacePGM`. This bug was manifesting itself when calling `SbgatCore::ComputeSurfacePGM` with a shape model whose coordinates were expressed in kilometers. This bug was not affecting `SbgatGui` since it automatically rescales input shapes to meters upon loading.


### [SBGAT 1.12.2](https://github.com/bbercovici/SBGAT/releases/tag/1.12.2)

### New:
Expand Down
7 changes: 7 additions & 0 deletions SbgatCore/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,13 @@ if(UNIX AND NOT APPLE AND ${CMAKE_MINOR_VERSION} GREATER 0 )
endif()
endif()


# Removing spurious include sometimes brought in by one of VTK's dependencies
get_property(dirs DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY INCLUDE_DIRECTORIES)
list(REMOVE_ITEM dirs "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include")
set_property(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY INCLUDE_DIRECTORIES ${dirs})


# Add source files in root directory
add_library(${LIB_NAME}
SHARED
Expand Down
28 changes: 12 additions & 16 deletions SbgatCore/source/SBGATSphericalHarmo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ SOFTWARE.
#include <vtkMath.h>
#include <vtkSmartPointer.h>
#include <vtkInformation.h>
#include <vtkCleanPolyData.h>
#include <vtkInformationVector.h>
#include <RigidBodyKinematics.hpp>
vtkStandardNewMacro(SBGATSphericalHarmo);
Expand Down Expand Up @@ -89,9 +90,15 @@ int SBGATSphericalHarmo::RequestData(
inputVector[0]->GetInformationObject(0);

// call ExecuteData
vtkPolyData *input = vtkPolyData::SafeDownCast(
inInfo->Get(vtkDataObject::DATA_OBJECT()));
vtkPolyData * input_unclean = vtkPolyData::SafeDownCast(inInfo->Get(vtkDataObject::DATA_OBJECT()));

vtkSmartPointer<vtkCleanPolyData> cleaner =
vtkSmartPointer<vtkCleanPolyData>::New();
cleaner -> SetInputData (input_unclean);
cleaner -> SetOutputPointsPrecision ( vtkAlgorithm::DesiredOutputPrecision::DOUBLE_PRECISION );
cleaner -> Update();

vtkPolyData * input = cleaner -> GetOutput();
vtkIdType cellId, numCells, numPts, numIds;

numCells = input->GetNumberOfCells();
Expand Down Expand Up @@ -140,7 +147,6 @@ int SBGATSphericalHarmo::RequestData(
numIds = ptIds->GetNumberOfIds();
assert(numIds == 3);

// store current vertex (x,y,z) coordinates ...
double r0[3];
double r1[3];
double r2[3];
Expand All @@ -149,15 +155,7 @@ int SBGATSphericalHarmo::RequestData(
input->GetPoint(ptIds->GetId(1), r1);
input->GetPoint(ptIds->GetId(2), r2);

double r1r0[3];
double r2r0[3];

vtkMath::Subtract(r1,r0,r1r0);
vtkMath::Subtract(r2,r0,r2r0);

double dv = vtkMath::Determinant3x3(r0,r1r0,r2r0) / 6;

arma::mat Cnm2f( this -> degree + 1, this -> degree + 1);
arma::mat Cnm2f(this -> degree + 1, this -> degree + 1);
arma::mat Snm2f(this -> degree + 1, this -> degree + 1);

// Call to SHARMLib here
Expand All @@ -172,11 +170,9 @@ int SBGATSphericalHarmo::RequestData(
this -> normalized
);

this -> Cnm += Cnm2f ;
this -> Snm += Snm2f ;


this -> Cnm += Cnm2f * dv ;
this -> Snm += Snm2f * dv ;

}

this -> Cnm /= mass_properties -> GetVolume();
Expand Down
7 changes: 7 additions & 0 deletions SbgatGui/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,13 @@ set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTORCC ON)


# Removing spurious include sometimes brought in by one of VTK's dependencies
get_property(dirs DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY INCLUDE_DIRECTORIES)
list(REMOVE_ITEM dirs "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include")
set_property(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY INCLUDE_DIRECTORIES ${dirs})


# Add source files in root directory
add_executable(${EXE_NAME}
source/main.cpp
Expand Down
6 changes: 6 additions & 0 deletions Tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,11 @@ include_directories(${SBGATCORE_INCLUDE_HEADER})
find_package(VTK REQUIRED PATHS ${VTK_PATH})
include(${VTK_USE_FILE})

# Removing spurious include sometimes brought in by one of VTK's dependencies
get_property(dirs DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY INCLUDE_DIRECTORIES)
list(REMOVE_ITEM dirs "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include")
set_property(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY INCLUDE_DIRECTORIES ${dirs})

# Add source files in root directory
add_executable(${EXE_NAME}
include/Tests.hpp
Expand All @@ -112,6 +117,7 @@ set(library_dependencies
)



target_link_libraries(${EXE_NAME} ${library_dependencies})


0 comments on commit d86ff80

Please sign in to comment.