View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0005499VTK(No Category)public2007-08-14 17:032008-07-26 13:14
ReporterLevap 
Assigned ToDavid Gobbi 
PrioritynormalSeveritycrashReproducibilityalways
StatusclosedResolutionfixed 
PlatformOSOS Version
Product Version 
Target VersionFixed in Version 
Summary0005499: Bug in vtkThinPlateSplineTransform::InternalUpdate()
DescriptionThe following code leads to crash: division by zero!

int nSize = 2;
vtkPoints* pScr = vtkPoints::New();
pScr->SetNumberOfPoints(nSize);

pScr->SetPoint(0, 0.0, 0.0, 0.0);
pScr->SetPoint(1, 5.0, 6.0, 0.0);

vtkPoints* pTrg = vtkPoints::New();
pTrg->SetNumberOfPoints(nSize);

pTrg->SetPoint(0, 0.0, 0.0, 0.0);
pTrg->SetPoint(1, 0.0, 0.0, 0.0);

vtkThinPlateSplineTransform* pT = vtkThinPlateSplineTransform::New();
pT->Modified();
pT->SetSourceLandmarks(pScr);
pT->SetTargetLandmarks(pTrg);
pT->Update();

pT->Delete();
Additional InformationThe problem is in vtkThinPlateSplineTransform.cxx line 373:

// normalize the two vectors
rs = sqrt(rs);
ds[0] /= rs; ds[1] /= rs; ds[2] /= rs;
rt = sqrt(rt);
dt[0] /= rt; dt[1] /= rt; dt[2] /= rt;

The value of rs and rt are zero! What is the right strategy in this case?
TagsNo tags attached.
Project
Type
Attached Files

 Relationships

  Notes
(0010428)
David Gobbi (developer)
2008-02-07 17:44

If there are duplicate landmarks within either the SourceLandmarks or TargetLandmarks, that qualifies as a bad input and a VTK error should be raised. I will add a check for this.
(0010585)
David Gobbi (developer)
2008-02-19 11:03
edited on: 2008-02-19 11:04

Fix committed on Friday, February 15 2008. Code will generate an warning when there are two coincident source or target points, and will no longer crash.


 Issue History
Date Modified Username Field Change
2007-08-14 17:03 Levap New Issue
2008-02-06 09:28 Jeff Baumes Status backlog => tabled
2008-02-06 09:28 Jeff Baumes Assigned To => David Gobbi
2008-02-07 17:44 David Gobbi Note Added: 0010428
2008-02-19 11:03 David Gobbi Note Added: 0010585
2008-02-19 11:04 David Gobbi Note Edited: 0010585
2008-07-25 08:55 David Gobbi Note Added: 0012819
2008-07-25 08:55 David Gobbi Resolution open => fixed
2008-07-25 08:56 David Gobbi Note Deleted: 0012819
2008-07-26 13:14 David Gobbi Status tabled => closed
2011-06-16 13:11 Zack Galbreath Category => (No Category)


Copyright © 2000 - 2018 MantisBT Team