Skip to content

Commit

Permalink
Merge pull request DGtal-team#1504 from kerautret/FixBasicSubSampler
Browse files Browse the repository at this point in the history
fix bug in BasicDomainSubSampler
  • Loading branch information
dcoeurjo authored Jul 25, 2020
2 parents 66088b0 + a246f62 commit 8e35dc1
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
4 changes: 4 additions & 0 deletions ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@
- Making `HyperRectDomain_(sub)Iterator` random-access iterators
(allowing parallel scans of the domain, Roland Denis,
[#1416](https://github.com/DGtal-team/DGtal/pull/1416))
- Fix bug in BasicDomainSubSampler for negative coordinates of the
domain lower bound. (Bertrand Kerautret
[#1504](https://github.com/DGtal-team/DGtal/pull/1504))


- *DEC*
- Add discrete calculus model of Ambrosio-Tortorelli functional in
Expand Down
7 changes: 5 additions & 2 deletions src/DGtal/kernel/BasicPointFunctors.h
Original file line number Diff line number Diff line change
Expand Up @@ -592,6 +592,7 @@ namespace functors
public:
typedef typename TDomain::Space Space;
typedef typename TDomain::Size Size;
typedef typename TDomain::Integer IntergerDom;
typedef typename Space::Dimension Dimension;
typedef typename Space::Point Point;

Expand All @@ -615,8 +616,10 @@ namespace functors
Point domainLowerBound=aSourceDomain.lowerBound();

for (Dimension dim=0; dim< Space::dimension; dim++){
domainLowerBound[dim] /= aGridSize[dim];
domainUpperBound[dim] /= aGridSize[dim];
domainLowerBound[dim] = static_cast<IntergerDom>(floor(NumberTraits<IntergerDom>::castToDouble(domainLowerBound[dim]) /
NumberTraits<TValue>::castToDouble( aGridSize[dim] )));
domainUpperBound[dim] = static_cast<IntergerDom>(floor(NumberTraits<IntergerDom>::castToDouble(domainUpperBound[dim]) /
NumberTraits<TValue>::castToDouble( aGridSize[dim] )));
}
myNewDomain = TDomain(domainLowerBound,
domainUpperBound);
Expand Down

0 comments on commit 8e35dc1

Please sign in to comment.