ccBoundingBoxEditorDlg.cpp 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597
  1. //##########################################################################
  2. //# #
  3. //# CLOUDCOMPARE #
  4. //# #
  5. //# This program is free software; you can redistribute it and/or modify #
  6. //# it under the terms of the GNU General Public License as published by #
  7. //# the Free Software Foundation; version 2 or later of the License. #
  8. //# #
  9. //# This program is distributed in the hope that it will be useful, #
  10. //# but WITHOUT ANY WARRANTY; without even the implied warranty of #
  11. //# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
  12. //# GNU General Public License for more details. #
  13. //# #
  14. //# COPYRIGHT: EDF R&D / TELECOM ParisTech (ENST-TSI) #
  15. //# #
  16. //##########################################################################
  17. #include "ccBoundingBoxEditorDlg.h"
  18. //systems
  19. #include <limits>
  20. //Qt
  21. #include <QClipboard>
  22. //Box state at last dialog execution
  23. static ccBBox s_lastBBox;
  24. // Left 'point type' combo box indexes
  25. static const int MinCornerIndex = 0;
  26. static const int CenterIndex = 1;
  27. static const int MaxCornerIndex = 2;
  28. //Helper
  29. static void MakeSquare(ccBBox& box, int pivotType, int defaultDim = -1)
  30. {
  31. assert(defaultDim < 3);
  32. assert(pivotType >= 0 && pivotType < 3);
  33. CCVector3 W = box.getDiagVec();
  34. if (W.x != W.y || W.x != W.z)
  35. {
  36. if (defaultDim < 0)
  37. {
  38. //we take the largest one!
  39. defaultDim = 0;
  40. if (W.u[1] > W.u[defaultDim])
  41. defaultDim = 1;
  42. if (W.u[2] > W.u[defaultDim])
  43. defaultDim = 2;
  44. }
  45. CCVector3 newW(W.u[defaultDim], W.u[defaultDim], W.u[defaultDim]);
  46. switch (pivotType)
  47. {
  48. case 0: //min corner
  49. {
  50. CCVector3 A = box.minCorner();
  51. box = ccBBox(A, A + newW, box.isValid());
  52. }
  53. break;
  54. case 1: //center
  55. {
  56. CCVector3 C = box.getCenter();
  57. box = ccBBox(C - newW / 2.0, C + newW / 2.0, box.isValid());
  58. }
  59. break;
  60. case 2: //max corner
  61. {
  62. CCVector3 B = box.maxCorner();
  63. box = ccBBox(B - newW, B, box.isValid());
  64. }
  65. break;
  66. }
  67. }
  68. }
  69. ccBoundingBoxEditorDlg::ccBoundingBoxEditorDlg(bool showBoxAxes, bool showRasterGridImage, QWidget* parent/*=nullptr*/)
  70. : QDialog(parent, Qt::Tool)
  71. , Ui::BoundingBoxEditorDialog()
  72. , m_baseBoxIsMinimal(false)
  73. , m_showInclusionWarning(true)
  74. {
  75. setupUi(this);
  76. oriGroupBox->setVisible(showBoxAxes);
  77. rasterGridImageLabel->setVisible(showRasterGridImage);
  78. resize(QSize(width(), computeBestDialogHeight(showBoxAxes, showRasterGridImage)));
  79. xDoubleSpinBox->setMinimum(-1.0e9);
  80. yDoubleSpinBox->setMinimum(-1.0e9);
  81. zDoubleSpinBox->setMinimum(-1.0e9);
  82. xDoubleSpinBox->setMaximum( 1.0e9);
  83. yDoubleSpinBox->setMaximum( 1.0e9);
  84. zDoubleSpinBox->setMaximum( 1.0e9);
  85. dxDoubleSpinBox->setMinimum( 0.0);
  86. dyDoubleSpinBox->setMinimum( 0.0);
  87. dzDoubleSpinBox->setMinimum( 0.0);
  88. dxDoubleSpinBox->setMaximum(1.0e9);
  89. dyDoubleSpinBox->setMaximum(1.0e9);
  90. dzDoubleSpinBox->setMaximum(1.0e9);
  91. connect(keepSquareCheckBox, &QCheckBox::toggled, this, &ccBoundingBoxEditorDlg::squareModeActivated);
  92. connect(okPushButton, &QPushButton::clicked, this, &ccBoundingBoxEditorDlg::saveBoxAndAccept);
  93. connect(cancelPushButton, &QPushButton::clicked, this, &ccBoundingBoxEditorDlg::cancel);
  94. connect(defaultPushButton, &QPushButton::clicked, this, &ccBoundingBoxEditorDlg::resetToDefault);
  95. connect(lastPushButton, &QPushButton::clicked, this, &ccBoundingBoxEditorDlg::resetToLast);
  96. connect(fromClipboardPushButton, &QPushButton::clicked, this, &ccBoundingBoxEditorDlg::fromClipboardClicked);
  97. connect(toClipboardPushButton, &QPushButton::clicked, this, &ccBoundingBoxEditorDlg::toClipboardClicked);
  98. connect(pointTypeComboBox, qOverload<int>(&QComboBox::currentIndexChanged), this, &ccBoundingBoxEditorDlg::reflectChanges);
  99. connect(xDoubleSpinBox, qOverload<double>(&QDoubleSpinBox::valueChanged), this, &ccBoundingBoxEditorDlg::updateCurrentBBox);
  100. connect(yDoubleSpinBox, qOverload<double>(&QDoubleSpinBox::valueChanged), this, &ccBoundingBoxEditorDlg::updateCurrentBBox);
  101. connect(zDoubleSpinBox, qOverload<double>(&QDoubleSpinBox::valueChanged), this, &ccBoundingBoxEditorDlg::updateCurrentBBox);
  102. connect(dxDoubleSpinBox, qOverload<double>(&QDoubleSpinBox::valueChanged), this, &ccBoundingBoxEditorDlg::updateXWidth);
  103. connect(dyDoubleSpinBox, qOverload<double>(&QDoubleSpinBox::valueChanged), this, &ccBoundingBoxEditorDlg::updateYWidth);
  104. connect(dzDoubleSpinBox, qOverload<double>(&QDoubleSpinBox::valueChanged), this, &ccBoundingBoxEditorDlg::updateZWidth);
  105. connect(xOriXDoubleSpinBox, qOverload<double>(&QDoubleSpinBox::valueChanged), this, &ccBoundingBoxEditorDlg::onAxisValueChanged);
  106. connect(xOriYDoubleSpinBox, qOverload<double>(&QDoubleSpinBox::valueChanged), this, &ccBoundingBoxEditorDlg::onAxisValueChanged);
  107. connect(xOriZDoubleSpinBox, qOverload<double>(&QDoubleSpinBox::valueChanged), this, &ccBoundingBoxEditorDlg::onAxisValueChanged);
  108. connect(yOriXDoubleSpinBox, qOverload<double>(&QDoubleSpinBox::valueChanged), this, &ccBoundingBoxEditorDlg::onAxisValueChanged);
  109. connect(yOriYDoubleSpinBox, qOverload<double>(&QDoubleSpinBox::valueChanged), this, &ccBoundingBoxEditorDlg::onAxisValueChanged);
  110. connect(yOriZDoubleSpinBox, qOverload<double>(&QDoubleSpinBox::valueChanged), this, &ccBoundingBoxEditorDlg::onAxisValueChanged);
  111. connect(zOriXDoubleSpinBox, qOverload<double>(&QDoubleSpinBox::valueChanged), this, &ccBoundingBoxEditorDlg::onAxisValueChanged);
  112. connect(zOriYDoubleSpinBox, qOverload<double>(&QDoubleSpinBox::valueChanged), this, &ccBoundingBoxEditorDlg::onAxisValueChanged);
  113. connect(zOriZDoubleSpinBox, qOverload<double>(&QDoubleSpinBox::valueChanged), this, &ccBoundingBoxEditorDlg::onAxisValueChanged);
  114. defaultPushButton->setVisible(false);
  115. lastPushButton->setVisible(s_lastBBox.isValid());
  116. checkBaseInclusion();
  117. if (showRasterGridImage)
  118. {
  119. pointTypeComboBox->setCurrentIndex(MinCornerIndex);
  120. }
  121. }
  122. void ccBoundingBoxEditorDlg::setBox(const ccBBox& box)
  123. {
  124. m_currentBBox = box;
  125. reflectChanges();
  126. checkBaseInclusion();
  127. }
  128. bool ccBoundingBoxEditorDlg::keepSquare() const
  129. {
  130. return keepSquareCheckBox->isChecked();
  131. }
  132. void ccBoundingBoxEditorDlg::forceKeepSquare(bool state)
  133. {
  134. if (state)
  135. keepSquareCheckBox->setChecked(true);
  136. keepSquareCheckBox->setDisabled(state);
  137. }
  138. void ccBoundingBoxEditorDlg::squareModeActivated(bool state)
  139. {
  140. if (state)
  141. {
  142. MakeSquare(m_currentBBox, pointTypeComboBox->currentIndex());
  143. reflectChanges();
  144. }
  145. }
  146. void ccBoundingBoxEditorDlg::set2DMode(bool state, unsigned char dim)
  147. {
  148. bool hideX = (state && dim == 0);
  149. bool hideY = (state && dim == 1);
  150. bool hideZ = (state && dim == 2);
  151. xDoubleSpinBox->setHidden(hideX);
  152. dxDoubleSpinBox->setHidden(hideX);
  153. xLabel->setHidden(hideX);
  154. yDoubleSpinBox->setHidden(hideY);
  155. dyDoubleSpinBox->setHidden(hideY);
  156. yLabel->setHidden(hideY);
  157. zDoubleSpinBox->setHidden(hideZ);
  158. dzDoubleSpinBox->setHidden(hideZ);
  159. zLabel->setHidden(hideZ);
  160. }
  161. void ccBoundingBoxEditorDlg::setBaseBBox(const ccBBox& box, bool isMinimal/*=true*/)
  162. {
  163. //set new default one
  164. m_initBBox = m_baseBBox = box;
  165. m_baseBoxIsMinimal = isMinimal;
  166. defaultPushButton->setVisible(m_baseBBox.isValid());
  167. resetToDefault();
  168. }
  169. void ccBoundingBoxEditorDlg::checkBaseInclusion()
  170. {
  171. bool exclude = false;
  172. if (m_baseBBox.isValid())
  173. {
  174. exclude = !m_currentBBox.contains(m_baseBBox.minCorner()) || !m_currentBBox.contains(m_baseBBox.maxCorner());
  175. }
  176. warningLabel->setVisible(m_showInclusionWarning && exclude);
  177. okPushButton->setEnabled(!m_baseBoxIsMinimal || !exclude);
  178. }
  179. void ccBoundingBoxEditorDlg::resetToDefault()
  180. {
  181. m_currentBBox = m_baseBBox;
  182. if (keepSquare())
  183. squareModeActivated(true); //will call reflectChanges
  184. else
  185. reflectChanges();
  186. checkBaseInclusion();
  187. }
  188. void ccBoundingBoxEditorDlg::resetToLast()
  189. {
  190. m_currentBBox = s_lastBBox;
  191. if (keepSquare())
  192. squareModeActivated(true); //will call reflectChanges
  193. else
  194. reflectChanges();
  195. checkBaseInclusion();
  196. }
  197. void ccBoundingBoxEditorDlg::saveBoxAndAccept()
  198. {
  199. if (oriGroupBox->isVisible())
  200. {
  201. CCVector3d X;
  202. CCVector3d Y;
  203. CCVector3d Z;
  204. getBoxAxes(X, Y, Z);
  205. X.normalize();
  206. Y.normalize();
  207. Z.normalize();
  208. if ( X.norm2d() == 0
  209. || Y.norm2d() == 0
  210. || Z.norm2d() == 0 )
  211. {
  212. ccLog::Error("Invalid axes definition: at least two vectors are colinear");
  213. return;
  214. }
  215. //if ( std::abs(X.dot(Y)) > 1.0e-6
  216. // || std::abs(Y.dot(Z)) > 1.0e-6
  217. // || std::abs(Z.dot(X)) > 1.0e-6 )
  218. //{
  219. // ccLog::Error("Invalid axes definition: vectors must be orthogonal");
  220. // return;
  221. //}
  222. }
  223. s_lastBBox = m_currentBBox;
  224. accept();
  225. }
  226. int ccBoundingBoxEditorDlg::exec()
  227. {
  228. //backup current box
  229. m_initBBox = m_currentBBox;
  230. //call 'true' exec
  231. return QDialog::exec();
  232. }
  233. void ccBoundingBoxEditorDlg::cancel()
  234. {
  235. //restore init. box
  236. setBox(m_initBBox);
  237. reject();
  238. }
  239. void ccBoundingBoxEditorDlg::updateXWidth(double value)
  240. {
  241. updateCurrentBBox(value);
  242. if (keepSquare())
  243. {
  244. MakeSquare(m_currentBBox, pointTypeComboBox->currentIndex(), 0);
  245. reflectChanges();
  246. //base box (if valid) should always be included!
  247. if (m_baseBBox.isValid())
  248. checkBaseInclusion();
  249. }
  250. }
  251. void ccBoundingBoxEditorDlg::updateYWidth(double value)
  252. {
  253. updateCurrentBBox(value);
  254. if (keepSquare())
  255. {
  256. MakeSquare(m_currentBBox, pointTypeComboBox->currentIndex(), 1);
  257. reflectChanges();
  258. //base box (if valid) should always be included!
  259. if (m_baseBBox.isValid())
  260. checkBaseInclusion();
  261. }
  262. }
  263. void ccBoundingBoxEditorDlg::updateZWidth(double value)
  264. {
  265. updateCurrentBBox(value);
  266. if (keepSquare())
  267. {
  268. MakeSquare(m_currentBBox, pointTypeComboBox->currentIndex(), 2);
  269. reflectChanges();
  270. //base box (if valid) should always be included!
  271. if (m_baseBBox.isValid())
  272. checkBaseInclusion();
  273. }
  274. }
  275. void ccBoundingBoxEditorDlg::updateCurrentBBox(double dummy)
  276. {
  277. CCVector3 A(static_cast<PointCoordinateType>(xDoubleSpinBox->value()),
  278. static_cast<PointCoordinateType>(yDoubleSpinBox->value()),
  279. static_cast<PointCoordinateType>(zDoubleSpinBox->value()));
  280. CCVector3 W(static_cast<PointCoordinateType>(dxDoubleSpinBox->value()),
  281. static_cast<PointCoordinateType>(dyDoubleSpinBox->value()),
  282. static_cast<PointCoordinateType>(dzDoubleSpinBox->value()));
  283. switch (pointTypeComboBox->currentIndex())
  284. {
  285. case 0: //A = min corner
  286. m_currentBBox = ccBBox(A, A + W, true);
  287. break;
  288. case 1: //A = center
  289. m_currentBBox = ccBBox(A - W / 2.0, A + W / 2.0, true);
  290. break;
  291. case 2: //A = max corner
  292. m_currentBBox = ccBBox(A - W, A, true);
  293. break;
  294. default:
  295. assert(false);
  296. return;
  297. }
  298. //base box (if valid) should always be included!
  299. if (m_baseBBox.isValid())
  300. {
  301. checkBaseInclusion();
  302. }
  303. }
  304. void ccBoundingBoxEditorDlg::reflectChanges(int dummy)
  305. {
  306. //left column
  307. {
  308. xDoubleSpinBox->blockSignals(true);
  309. yDoubleSpinBox->blockSignals(true);
  310. zDoubleSpinBox->blockSignals(true);
  311. switch (pointTypeComboBox->currentIndex())
  312. {
  313. case MinCornerIndex: //A = min corner
  314. {
  315. const CCVector3& A = m_currentBBox.minCorner();
  316. xDoubleSpinBox->setValue(A.x);
  317. yDoubleSpinBox->setValue(A.y);
  318. zDoubleSpinBox->setValue(A.z);
  319. }
  320. break;
  321. case CenterIndex: //A = center
  322. {
  323. CCVector3 C = m_currentBBox.getCenter();
  324. xDoubleSpinBox->setValue(C.x);
  325. yDoubleSpinBox->setValue(C.y);
  326. zDoubleSpinBox->setValue(C.z);
  327. }
  328. break;
  329. case MaxCornerIndex: //A = max corner
  330. {
  331. const CCVector3& B = m_currentBBox.maxCorner();
  332. xDoubleSpinBox->setValue(B.x);
  333. yDoubleSpinBox->setValue(B.y);
  334. zDoubleSpinBox->setValue(B.z);
  335. }
  336. break;
  337. default:
  338. assert(false);
  339. return;
  340. }
  341. xDoubleSpinBox->blockSignals(false);
  342. yDoubleSpinBox->blockSignals(false);
  343. zDoubleSpinBox->blockSignals(false);
  344. }
  345. //right column
  346. {
  347. dxDoubleSpinBox->blockSignals(true);
  348. dyDoubleSpinBox->blockSignals(true);
  349. dzDoubleSpinBox->blockSignals(true);
  350. CCVector3 W = m_currentBBox.getDiagVec();
  351. //if 'square mode' is on, all width values should be the same!
  352. assert(!keepSquare() || std::abs(W.x - W.y)*1.0e-6 < 1.0 && std::abs(W.x - W.z)*1.0e-6 < 1.0);
  353. dxDoubleSpinBox->setValue(W.x);
  354. dyDoubleSpinBox->setValue(W.y);
  355. dzDoubleSpinBox->setValue(W.z);
  356. dxDoubleSpinBox->blockSignals(false);
  357. dyDoubleSpinBox->blockSignals(false);
  358. dzDoubleSpinBox->blockSignals(false);
  359. }
  360. }
  361. int ccBoundingBoxEditorDlg::computeBestDialogHeight(bool showBoxAxes, bool showRasterGridImage) const
  362. {
  363. //we always keep space to display the grid
  364. int height = gridFrame->height();
  365. int blockCount = 1;
  366. //we always keep space to display the warning label
  367. {
  368. height += warningLabel->height();
  369. ++blockCount;
  370. }
  371. if (showBoxAxes)
  372. {
  373. height += oriGroupBox->height();
  374. ++blockCount;
  375. }
  376. if (showRasterGridImage)
  377. {
  378. height += rasterGridImageLabel->height();
  379. ++blockCount;
  380. }
  381. //we always keep space to display the buttons
  382. {
  383. height += buttonFrame->height();
  384. ++blockCount;
  385. }
  386. if (layout())
  387. {
  388. height += layout()->contentsMargins().top() + layout()->spacing() * (blockCount - 1) + layout()->contentsMargins().bottom();
  389. }
  390. return height;
  391. }
  392. void ccBoundingBoxEditorDlg::setBoxAxes(const CCVector3& X, const CCVector3& Y, const CCVector3& Z)
  393. {
  394. //if (xOriFrame->isEnabled())
  395. {
  396. xOriXDoubleSpinBox->setValue(X.x);
  397. xOriYDoubleSpinBox->setValue(X.y);
  398. xOriZDoubleSpinBox->setValue(X.z);
  399. }
  400. //if (yOriFrame->isEnabled())
  401. {
  402. yOriXDoubleSpinBox->setValue(Y.x);
  403. yOriYDoubleSpinBox->setValue(Y.y);
  404. yOriZDoubleSpinBox->setValue(Y.z);
  405. }
  406. //if (zOriFrame->isEnabled())
  407. {
  408. zOriXDoubleSpinBox->setValue(Z.x);
  409. zOriYDoubleSpinBox->setValue(Z.y);
  410. zOriZDoubleSpinBox->setValue(Z.z);
  411. }
  412. }
  413. void ccBoundingBoxEditorDlg::getBoxAxes(CCVector3d& X, CCVector3d& Y, CCVector3d& Z)
  414. {
  415. X = CCVector3d( xOriXDoubleSpinBox->value(),
  416. xOriYDoubleSpinBox->value(),
  417. xOriZDoubleSpinBox->value() );
  418. Y = CCVector3d( yOriXDoubleSpinBox->value(),
  419. yOriYDoubleSpinBox->value(),
  420. yOriZDoubleSpinBox->value() );
  421. Z = CCVector3d( zOriXDoubleSpinBox->value(),
  422. zOriYDoubleSpinBox->value(),
  423. zOriZDoubleSpinBox->value() );
  424. }
  425. void ccBoundingBoxEditorDlg::onAxisValueChanged(double)
  426. {
  427. CCVector3d X;
  428. CCVector3d Y;
  429. CCVector3d Z;
  430. getBoxAxes(X, Y, Z);
  431. QDoubleSpinBox* vecSpinBoxes[3] = { nullptr, nullptr, nullptr };
  432. CCVector3d N(0, 0, 0);
  433. if (oriXCheckBox->isChecked())
  434. {
  435. N = Y.cross(Z);
  436. vecSpinBoxes[0] = xOriXDoubleSpinBox;
  437. vecSpinBoxes[1] = xOriYDoubleSpinBox;
  438. vecSpinBoxes[2] = xOriZDoubleSpinBox;
  439. }
  440. else if (oriYCheckBox->isChecked())
  441. {
  442. N = Z.cross(X);
  443. vecSpinBoxes[0] = yOriXDoubleSpinBox;
  444. vecSpinBoxes[1] = yOriYDoubleSpinBox;
  445. vecSpinBoxes[2] = yOriZDoubleSpinBox;
  446. }
  447. else if (oriZCheckBox->isChecked())
  448. {
  449. N = X.cross(Y);
  450. vecSpinBoxes[0] = zOriXDoubleSpinBox;
  451. vecSpinBoxes[1] = zOriYDoubleSpinBox;
  452. vecSpinBoxes[2] = zOriZDoubleSpinBox;
  453. }
  454. else
  455. {
  456. assert(false);
  457. }
  458. for (int i = 0; i < 3; ++i)
  459. {
  460. vecSpinBoxes[i]->blockSignals(true);
  461. vecSpinBoxes[i]->setValue(N.u[i]);
  462. vecSpinBoxes[i]->blockSignals(false);
  463. }
  464. }
  465. void ccBoundingBoxEditorDlg::fromClipboardClicked()
  466. {
  467. QClipboard* clipboard = QApplication::clipboard();
  468. if (clipboard)
  469. {
  470. QString clipText = clipboard->text();
  471. if (!clipText.isEmpty())
  472. {
  473. bool success = false;
  474. ccGLMatrix matrix = ccGLMatrix::FromString(clipText, success);
  475. if (success)
  476. {
  477. //set center
  478. CCVector3 C = m_currentBBox.getCenter();
  479. CCVector3 delta = matrix.getTranslationAsVec3D() - C;
  480. m_currentBBox += delta;
  481. reflectChanges();
  482. //change axes
  483. setBoxAxes( matrix.getColumnAsVec3D(0),
  484. matrix.getColumnAsVec3D(1),
  485. matrix.getColumnAsVec3D(2) );
  486. }
  487. else
  488. {
  489. ccLog::Error("Failed to extract matrix from clipboard");
  490. }
  491. }
  492. else
  493. {
  494. ccLog::Error("Clipboard is empty");
  495. }
  496. }
  497. }
  498. void ccBoundingBoxEditorDlg::toClipboardClicked()
  499. {
  500. QClipboard* clipboard = QApplication::clipboard();
  501. if (clipboard)
  502. {
  503. CCVector3 C = m_currentBBox.getCenter();
  504. CCVector3d X;
  505. CCVector3d Y;
  506. CCVector3d Z;
  507. getBoxAxes(X, Y, Z);
  508. ccGLMatrix matrix;
  509. matrix.setColumn(0, X.toPC());
  510. matrix.setColumn(1, Y.toPC());
  511. matrix.setColumn(2, Z.toPC());
  512. matrix.setTranslation(C);
  513. clipboard->setText(matrix.toString());
  514. ccLog::Print("Matrix saved to clipboard:");
  515. ccLog::Print(matrix.toString(12, ' ')); //full precision
  516. }
  517. }