/////////////////////////////////////////////////////////////////////////////// // Copyright (C) 2002-2025, Open Design Alliance (the "Alliance"). // All rights reserved. // // This software and its documentation and related materials are owned by // the Alliance. The software may only be incorporated into application // programs owned by members of the Alliance, subject to a signed // Membership Agreement and Supplemental Software License Agreement with the // Alliance. The structure and organization of this software are the valuable // trade secrets of the Alliance and its suppliers. The software is also // protected by copyright law and international treaty provisions. Application // programs incorporating this software must include the following statement // with their copyright notices: // // This application incorporates Open Design Alliance software pursuant to a license // agreement with Open Design Alliance. // Open Design Alliance Copyright (C) 2002-2025 by Open Design Alliance. // All rights reserved. // // By use of this software, its documentation or related materials, you // acknowledge and accept the above terms. /////////////////////////////////////////////////////////////////////////////// #include "OdaCommon.h" #include "StaticRxObject.h" #include "ExSystemServices.h" #include "DynamicLinker.h" #include "diagnostics.h" #include "RxDynamicModule.h" #include "RcsFileServices/RxRcsFileServices.h" #define STL_USING_IOSTREAM #include "OdaSTL.h" #define STD(a) std:: a #ifdef OD_HAVE_CONSOLE_H_FILE #include #endif #include "ExPrintConsole.h" #ifndef _TOOLKIT_IN_DLL_ ODRX_DECLARE_STATIC_MODULE_ENTRY_POINT(RcsFileServicesModule); ODRX_BEGIN_STATIC_MODULE_MAP() ODRX_DEFINE_STATIC_APPMODULE(RX_RCS_FILE_SERVICES, RcsFileServicesModule) ODRX_END_STATIC_MODULE_MAP() #endif static const char cUsage[] = { "RcpPointCloudProjectWriteEx sample program. Copyright (C) " TD_COPYRIGHT_START_YEAR_S TD_COPYRIGHT_END_S "\n" "Usage: RcpPointCloudProjectWriteEx \n" "\nPress ENTER to continue...\n" }; #if defined(OD_USE_WMAIN) int wmain(int argc, wchar_t* argv[]) #else int main(int argc, char* argv[]) #endif { #ifdef OD_HAVE_CCOMMAND_FUNC argc = ccommand(&argv); #endif /**********************************************************************/ /* Verify the argument count and display an error message as required */ /**********************************************************************/ if (argc < 2) { STD(cout) << cUsage; STD(cin).get(); return 1; } #ifndef _TOOLKIT_IN_DLL_ ODRX_INIT_STATIC_MODULE_MAP(); #endif /**********************************************************************/ /* Initialize Runtime Extension environment */ /**********************************************************************/ OdStaticRxObject svcs; odrxInitialize(&svcs); OdString filePath(argv[1]); try { OdRxRcsFileServicesPtr pModule = odrxDynamicLinker()->loadModule("RcsFileServices"); OdRcpFileWriterPtr pWriter = pModule->getRcpFileWriter(); //Add first scan description: { OdPointCloudScanDatabasePtr pScanDb = pModule->readRcsFile(OD_T("bunny1.rcs")); OdRcsFileDescriptor scanDesc1; scanDesc1.m_scanId = pScanDb->getScanId(); scanDesc1.m_translation = pScanDb->getTranslation(); //modify rotation: scanDesc1.m_rotation = OdGeVector3d(270., 180, 90.); scanDesc1.m_scale = pScanDb->getScale(); scanDesc1.m_visible = true; scanDesc1.m_scanTitle = OD_T("Bunny 1"); scanDesc1.m_relativePath = OD_T("./bunny1.rcs"); scanDesc1.m_numPoints = pScanDb->getTotalAmountOfPoints(); scanDesc1.m_hasRGB = pScanDb->hasRGB(); scanDesc1.m_hasNormals = pScanDb->hasNormals(); scanDesc1.m_hasIntensity = pScanDb->hasIntensity(); scanDesc1.m_normalizeIntensity = pScanDb->getNormalizeIntensity(); scanDesc1.m_rangeImageWidth = pScanDb->getRangeImageWidth(); scanDesc1.m_rangeImageHeight = pScanDb->getRangeImageHeight(); scanDesc1.m_isLidarData = pScanDb->isLidarData(); //push scan descriptor to project: pWriter->addScan(scanDesc1); } //Add second scan description: { OdPointCloudScanDatabasePtr pScanDb = pModule->readRcsFile(OD_T("bunny2.rcs")); OdRcsFileDescriptor scanDesc2; scanDesc2.m_scanId = pScanDb->getScanId(); //Add additional translation to the second scan: OdGeVector3d additionalTranslation(0.3, 0., 0.); scanDesc2.m_translation = pScanDb->getTranslation() + additionalTranslation; //modify rotation: scanDesc2.m_rotation = OdGeVector3d(270., 180, 90.); scanDesc2.m_scale = pScanDb->getScale(); scanDesc2.m_visible = true; scanDesc2.m_scanTitle = OD_T("Bunny 2"); scanDesc2.m_relativePath = OD_T("./bunny2.rcs"); scanDesc2.m_numPoints = pScanDb->getTotalAmountOfPoints(); scanDesc2.m_hasRGB = pScanDb->hasRGB(); scanDesc2.m_hasNormals = pScanDb->hasNormals(); scanDesc2.m_hasIntensity = pScanDb->hasIntensity(); scanDesc2.m_normalizeIntensity = pScanDb->getNormalizeIntensity(); scanDesc2.m_rangeImageWidth = pScanDb->getRangeImageWidth(); scanDesc2.m_rangeImageHeight = pScanDb->getRangeImageHeight(); scanDesc2.m_isLidarData = pScanDb->isLidarData(); //push scan descriptor to project: pWriter->addScan(scanDesc2); } //Set data of active camera: OdRcpAutoCamCamera camera; camera.m_eye = OdGeVector3d(-0.300025769877978, -0.590396242024402, 0.310517609815137);//camera position camera.m_center = OdGeVector3d(-0.0482116817347668, -0.0761052302325277, 0.0733974367678163);//camera target camera.m_up = OdGeVector3d(0.168241886968496, 0.343607821598899, 0.923920089837503);//up vector pWriter->setAutoCamCamera(camera); //Set data of home camera (default camera position for the project): OdRcpAutoCamHomeCamera homeCamera; homeCamera.m_eye = OdGeVector3d(-0.151453842572123, -0.0239018230436232, 0.0972836288698147);//camera position homeCamera.m_center = OdGeVector3d(-0.0289571610769357, 0.0985948584515637, -0.0252130526253721);//camera target homeCamera.m_up = OdGeVector3d(0.408248290463863, 0.408248290463863, 0.816496580927726);//up vector pWriter->setAutoCamHomeCamera(homeCamera); //Write result .rcp file: pWriter->writeFile(filePath); odrxDynamicLinker()->unloadModule("RcsFileServices"); } catch (OdError e) { odPrintConsoleString(e.description()); } /**********************************************************************/ /* Uninitialize Runtime Extension environment */ /**********************************************************************/ ::odrxUninitialize(); return 0; }