[OpenWalnut-Dev] [OWci] r7591: [ADD] included also opacity weights into VisiTrace implementation --> VisiTrace should be complete now
Stefan Philips
philips at informatik.uni-leipzig.de
Fri Jun 9 11:39:22 CEST 2017
Oh, sorry, this wasn't meant for the list.
On 09.06.2017 11:37, Stefan Philips wrote:
> Hallo Alex,
>
> was spricht dagegen, das pickingDVR-Modul in einer eigenen Toolbox zu
> entwickeln?
>
> Dafür spricht, dass
> - das mal so verabredet wurde (keine neuen Module in das Kern-OpenWalnut)
> - das OpenWalnut-Repo bleibt übersichtlicher
> - das Modul noch stark in der Entwicklung ist
> - das Modul (soweit ich weiß) keine Grundfunktionalität bereitstellt
> - ich muß nicht immer nachsehen, ob etwas an OpenWalnut verändert wurde
>
> Bitte nicht böse auffassen, aber eigentlich haben wir (Mathias, André
> und ich) hier immer Toolboxen benutzt. Dafür gibt es ja das Modules-Repo.
>
> Viele Grüße
>
> Stefan
>
>
> On 08.06.2017 17:56, Alexander Wiebel wrote:
>> *Branch default*
>> [ADD] included also opacity weights into VisiTrace implementation -->
>> VisiTrace should be complete now
>>
>> changeset 7591:e439839253c7 in /srv/hg/ow (Thu Jun 08 17:56:29 2017
>> +0200):
>>
>> http://www.openwalnut.org/projects/openwalnut/repository/revisions/7591
>>
>> diffstat:
>>
>> src/modules/pickingDVR/WMPickingDVR.cpp | 2 +-
>> src/modules/pickingDVR/WVisiTrace.cpp | 38
>> +++++++++++++++++++++++---
>> src/modules/pickingDVR/test/WVisiTrace_test.h | 14 ++++----
>> 3 files changed, 41 insertions(+), 13 deletions(-)
>>
>> diffs (136 lines):
>>
>> diff -r f9268f0c62e9 -r e439839253c7
>> src/modules/pickingDVR/WMPickingDVR.cpp
>> --- a/src/modules/pickingDVR/WMPickingDVR.cpp Thu Jun 08 17:41:00
>> 2017 +0200
>> +++ b/src/modules/pickingDVR/WMPickingDVR.cpp Thu Jun 08 17:56:29
>> 2017 +0200
>> @@ -104,7 +104,7 @@
>> m_selectionTypesList = boost::shared_ptr< WItemSelection >( new
>> WItemSelection() );
>> m_selectionTypesList->addItem( "Position (Picking)" );
>> m_selectionTypesList->addItem( "Line (First Hit)" );
>> - m_selectionTypesList->addItem( "Line (VisiTrace) [NOT YET
>> CORRECTLY IMPLEMENTED]" );
>> + m_selectionTypesList->addItem( "Line (VisiTrace)" );
>> m_selectionType = m_properties->addProperty( "Selection type",
>> "What type of
>> structure is to be selected in the DVR?",
>> m_selectionTypesList->getSelectorFirst(),
>> diff -r f9268f0c62e9 -r e439839253c7
>> src/modules/pickingDVR/WVisiTrace.cpp
>> --- a/src/modules/pickingDVR/WVisiTrace.cpp Thu Jun 08 17:41:00
>> 2017 +0200
>> +++ b/src/modules/pickingDVR/WVisiTrace.cpp Thu Jun 08 17:56:29
>> 2017 +0200
>> @@ -132,12 +132,15 @@
>> }
>> std::vector< Edge > edgeVector( 0 );
>> - std::vector< double > weightsV( 0 );
>> + std::vector< double > distanceWeights( 0 );
>> + std::vector< double > opacityWeights( 0 );
>> +
>> // Edges from virtual start node to candidates of first ray
>> for( auto candi : linearizedInverse[0] )
>> {
>> edgeVector.push_back( Edge( startNodeId, candi +
>> numVirtNodes ) );
>> - weightsV.push_back( 1 );
>> + distanceWeights.push_back( 1 );
>> + opacityWeights.push_back( 1 );
>> }
>> // Edges from candidates of one ray to those of the next ray
>> @@ -152,20 +155,45 @@
>> WPosition firstPos =
>> m_candidatePositions[rayId][firstId];
>> WPosition secondPos =
>> m_candidatePositions[rayId+1][secondId];
>> double distance = length( firstPos - secondPos );
>> - weightsV.push_back( distance );
>> + distanceWeights.push_back( distance );
>> + opacityWeights.push_back( 1 -
>> m_candidateJumps[rayId+1][secondId] );
>> }
>> }
>> }
>> + // Normalize distance weights
>> + {
>> + double maxDistance = 0;
>> + for( auto distance : distanceWeights )
>> + {
>> + if( distance > maxDistance )
>> + {
>> + maxDistance = distance;
>> + }
>> + }
>> + for( double& weight : distanceWeights ) // NOLINT
>> + {
>> + weight /= maxDistance;
>> + }
>> + }
>> +
>> // Edges from candidates of last ray to virtual end node
>> for( auto candi : linearizedInverse[linearizedInverse.size()-1] )
>> {
>> edgeVector.push_back( Edge( candi + numVirtNodes, endNodeId
>> ) );
>> - weightsV.push_back( 1 );
>> + distanceWeights.push_back( 1 );
>> + opacityWeights.push_back( 1 );
>> + }
>> +
>> + WAssert( distanceWeights.size() == opacityWeights.size(),
>> "Internal error: Need as many opacities as positions." );
>> + std::vector< double > overallWeights( distanceWeights.size() );
>> + for( size_t weightId = 0; weightId < overallWeights.size();
>> ++weightId )
>> + {
>> + overallWeights[weightId] = opacityWeights[weightId] *
>> distanceWeights[weightId] * distanceWeights[weightId];
>> }
>> Edge* edge_array = &edgeVector[0];
>> - double* weights = &weightsV[0];
>> + double* weights = &overallWeights[0];
>> int num_arcs = edgeVector.size();
>> graph_t g( edge_array, edge_array + num_arcs, weights,
>> num_nodes );
>> diff -r f9268f0c62e9 -r e439839253c7
>> src/modules/pickingDVR/test/WVisiTrace_test.h
>> --- a/src/modules/pickingDVR/test/WVisiTrace_test.h Thu Jun 08
>> 17:41:00 2017 +0200
>> +++ b/src/modules/pickingDVR/test/WVisiTrace_test.h Thu Jun 08
>> 17:56:29 2017 +0200
>> @@ -86,7 +86,7 @@
>> TS_ASSERT_EQUALS( order[2], std::make_pair( 0, 2 ) );
>> TS_ASSERT_EQUALS( order[3], std::make_pair( 0, 3 ) );
>> - TS_ASSERT_EQUALS( order[5], std::make_pair( 1, 1 ) );
>> + TS_ASSERT_EQUALS( order[5], std::make_pair( 1, 1 ) );
>> TS_ASSERT_EQUALS( order[6], std::make_pair( 2, 0 ) );
>> TS_ASSERT_EQUALS( order[27], std::make_pair( 5, 5 ) );
>> @@ -123,7 +123,7 @@
>> }
>> /**
>> - * Check throwing of Dijkstra
>> + * Check throwing of Dijkstra and result according to VisiTrace
>> with constant opacity weights.
>> */
>> void testPerformDijkstraException()
>> {
>> @@ -137,7 +137,7 @@
>> WPosition( 1, 0, 3 )
>> }
>> );
>> - myVisiTrace.m_candidateJumps.push_back( { 1.0, 1.0, 1.0, 1.0
>> } ); // NOLINT
>> + myVisiTrace.m_candidateJumps.push_back( { 0.5, 0.5, 0.5, 0.5
>> } ); // NOLINT
>> myVisiTrace.m_candidatePositions.push_back(
>> {
>> @@ -145,7 +145,7 @@
>> WPosition( 1, 1, -2.5 )
>> }
>> );
>> - myVisiTrace.m_candidateJumps.push_back( { 1.0, 1.0 } ); //
>> NOLINT
>> + myVisiTrace.m_candidateJumps.push_back( { 0.5, 0.5 } ); //
>> NOLINT
>> myVisiTrace.m_candidatePositions.push_back(
>> {
>> @@ -155,11 +155,11 @@
>> WPosition( 1, 1.2, 3 )
>> }
>> );
>> - myVisiTrace.m_candidateJumps.push_back( { 1.0, 1.0, 1.0, 1.0
>> } ); // NOLINT
>> + myVisiTrace.m_candidateJumps.push_back( { 0.5, 0.5, 0.5, 0.5
>> } ); // NOLINT
>> - TS_ASSERT( myVisiTrace.m_candidatePositions.size() != 0 );
>> + TS_ASSERT_EQUALS( myVisiTrace.m_candidatePositions.size(), 3 );
>> TS_ASSERT_THROWS_NOTHING( myVisiTrace.performDijkstra() );
>> - TS_ASSERT( myVisiTrace.m_curve3D.size() !=0 );
>> + TS_ASSERT_EQUALS( myVisiTrace.m_curve3D.size(), 3 );
>> TS_ASSERT_EQUALS( myVisiTrace.m_curve3D[0], WPosition( 1,
>> 0, 0 ) );
>> TS_ASSERT_EQUALS( myVisiTrace.m_curve3D[1], WPosition( 1,
>> 1, -2.5 ) );
>> TS_ASSERT_EQUALS( myVisiTrace.m_curve3D[2], WPosition( 1,
>> 1.2, 0 ) );
>> _______________________________________________
>> All-openwalnut-commits mailing list
>> All-openwalnut-commits at lists.informatik.uni-leipzig.de
>> http://lists.informatik.uni-leipzig.de/mailman/listinfo/all-openwalnut-commits
>>
>>
>
> _______________________________________________
> OpenWalnut-Dev mailing list
> OpenWalnut-Dev at lists.informatik.uni-leipzig.de
> http://lists.informatik.uni-leipzig.de/mailman/listinfo/openwalnut-dev
>
> Archive: http://lists.informatik.uni-leipzig.de/pipermail/openwalnut-dev/
>
More information about the OpenWalnut-Dev
mailing list