From: <coe...@us...> - 2012-08-31 12:09:32
|
Revision: 419 http://mevislabmodules.svn.sourceforge.net/mevislabmodules/?rev=419&view=rev Author: coertmetz Date: 2012-08-31 12:09:21 +0000 (Fri, 31 Aug 2012) Log Message: ----------- CM: Added homogeneous 2D field. Modified Paths: -------------- trunk/Community/General/Sources/ML/MLXMarkerListCommunityModules/TransformXMarkerList/mlTransformXMarkerList.cpp trunk/Community/General/Sources/ML/MLXMarkerListCommunityModules/TransformXMarkerList/mlTransformXMarkerList.h Modified: trunk/Community/General/Sources/ML/MLXMarkerListCommunityModules/TransformXMarkerList/mlTransformXMarkerList.cpp =================================================================== --- trunk/Community/General/Sources/ML/MLXMarkerListCommunityModules/TransformXMarkerList/mlTransformXMarkerList.cpp 2012-08-31 12:07:51 UTC (rev 418) +++ trunk/Community/General/Sources/ML/MLXMarkerListCommunityModules/TransformXMarkerList/mlTransformXMarkerList.cpp 2012-08-31 12:09:21 UTC (rev 419) @@ -93,6 +93,9 @@ _homogeneousFld = fields->addBool("divideByHomogeneousCoordinate"); _homogeneousFld->setBoolValue(false); + _homogeneous2DFld = fields->addBool("divideByZCoordinate"); + _homogeneous2DFld->setBoolValue(false); + // Reactivate calls of handleNotification on field changes. handleNotificationOn(); } @@ -131,12 +134,13 @@ if (!_transformEnabled->getBoolValue()) matrix = mat4::getIdentity(); + // Clear output list + _outXMarkerList.clearList(); + // Transform XMarkers Base *baseValue = _inputXMarkerList->getBaseValue(); if (baseValue && BASE_IS_A(baseValue,XMarkerList)) { XMarkerList *inXMarkerList = (XMarkerList *) baseValue; - // Clear output list - _outXMarkerList.clearList(); for (int i=0; i<int(inXMarkerList->getSize()); ++i) { // Get marker position and transform it XMarker marker = inXMarkerList->at (i); @@ -152,13 +156,19 @@ marker.y() = vMarker[1]; marker.z() = vMarker[2]; } + if (_homogeneous2DFld->getBoolValue() && marker.z() != 0.0) + { + marker.pos[0] = marker.pos[0] / marker.pos[2]; + marker.pos[1] = marker.pos[1] / marker.pos[2]; + marker.pos[2] = 1.0; + } // Add marker to output list _outXMarkerList.appendItem (marker); } // Select XMarker which is selected in input list and notify attachments _outXMarkerList.doSelectItem(inXMarkerList->getCurrentIndex()); - _outputXMarkerList->notifyAttachments(); } + _outputXMarkerList->notifyAttachments(); } ML_END_NAMESPACE Modified: trunk/Community/General/Sources/ML/MLXMarkerListCommunityModules/TransformXMarkerList/mlTransformXMarkerList.h =================================================================== --- trunk/Community/General/Sources/ML/MLXMarkerListCommunityModules/TransformXMarkerList/mlTransformXMarkerList.h 2012-08-31 12:07:51 UTC (rev 418) +++ trunk/Community/General/Sources/ML/MLXMarkerListCommunityModules/TransformXMarkerList/mlTransformXMarkerList.h 2012-08-31 12:09:21 UTC (rev 419) @@ -98,6 +98,7 @@ //! Field to enable homogeneous coordinates BoolField *_homogeneousFld; + BoolField *_homogeneous2DFld; //@} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |