# HG changeset patch # User Sebastien Jodogne # Date 1496219720 -7200 # Node ID af312ce4fe594b7cb010559d2eb6919efdc34dd0 # Parent 166a555becbf9cbfddb81c6665d6cee81b19f0a2 support of 3D swapping of the normal diff -r 166a555becbf -r af312ce4fe59 Applications/Samples/SingleFrameApplication.h --- a/Applications/Samples/SingleFrameApplication.h Tue May 30 22:22:04 2017 +0200 +++ b/Applications/Samples/SingleFrameApplication.h Wed May 31 10:35:20 2017 +0200 @@ -152,10 +152,20 @@ #else // TEST for scene extents - Rotate the axes double a = 15.0 / 180.0 * M_PI; - + +#if 1 Vector x; GeometryToolbox::AssignVector(x, cos(a), sin(a), 0); Vector y; GeometryToolbox::AssignVector(y, -sin(a), cos(a), 0); +#else + // Flip the normal + Vector x; GeometryToolbox::AssignVector(x, cos(a), sin(a), 0); + Vector y; GeometryToolbox::AssignVector(y, sin(a), -cos(a), 0); +#endif + SliceGeometry s(source_->GetSlice(slice_).GetGeometry().GetOrigin(), x, y); + GeometryToolbox::Print(s.GetAxisX()); + GeometryToolbox::Print(s.GetAxisY()); + GeometryToolbox::Print(s.GetNormal()); widget_->SetSlice(s); #endif } @@ -241,7 +251,7 @@ std::auto_ptr widget(new LayerWidget); -#if 1 +#if 0 std::auto_ptr layer (new OrthancFrameLayerSource(context.GetWebService())); //layer->SetImageQuality(SliceImageQuality_Jpeg50); @@ -267,7 +277,7 @@ ct.reset(new OrthancFrameLayerSource(context.GetWebService())); //ct->LoadInstance("c804a1a2-142545c9-33b32fe2-3df4cec0-a2bea6d6", 0); //ct->LoadInstance("4bd4304f-47478948-71b24af2-51f4f1bc-275b6c1b", 0); // BAD SLICE - ct->SetImageQuality(SliceImageQuality_Jpeg50); + //ct->SetImageQuality(SliceImageQuality_Jpeg50); ct->LoadSeries("dd069910-4f090474-7d2bba07-e5c10783-f9e4fb1d"); ct->Register(*this); diff -r 166a555becbf -r af312ce4fe59 Framework/Toolbox/Slice.cpp --- a/Framework/Toolbox/Slice.cpp Tue May 30 22:22:04 2017 +0200 +++ b/Framework/Toolbox/Slice.cpp Wed May 31 10:35:20 2017 +0200 @@ -178,8 +178,11 @@ { throw Orthanc::OrthancException(Orthanc::ErrorCode_BadSequenceOfCalls); } - - return (GeometryToolbox::IsParallel(GetGeometry().GetNormal(), plane.GetNormal()) && + + bool opposite; + return (GeometryToolbox::IsParallelOrOpposite(opposite, + GetGeometry().GetNormal(), + plane.GetNormal()) && GeometryToolbox::IsNear(GetGeometry().ProjectAlongNormal(GetGeometry().GetOrigin()), GetGeometry().ProjectAlongNormal(plane.GetOrigin()), thickness_ / 2.0));