Beispiel #1
0
#  GNU General Public License for more details.                          #
#                                                                        #
#          Copyright 2020 Paul RASCLE www.openfields.fr                  #
#                                                                        #
##########################################################################

import os
import sys
import math
from gendata import getSampleCloud, getSamplePoly, dataDir, isCoordEqual, createSymbolicLinks
import cloudComPy as cc

createSymbolicLinks()  # required for tests on build, before cc.initCC.init
cc.initCC()  # to do once before using plugins or dealing with numpy

cloud1 = cc.loadPointCloud(getSampleCloud(5.0))
cloud1.setName("cloud1")

cloud2ref = cc.loadPointCloud(getSampleCloud(5.0, 9.0))
cloud2ref.setName("cloud2_reference")

cloud2 = cloud2ref.cloneThis()
tr1 = cc.ccGLMatrix()
# -------------------- z -- y -- x
tr1.initFromParameters(0.0, 0.0, 0.1, (0.0, 0.0, 0.3))
cloud2.applyRigidTransformation(tr1)
cloud2.setName("cloud2_transformed")

cc.SaveEntities([cloud1, cloud2ref, cloud2],
                os.path.join(dataDir, "clouds2.bin"))
Beispiel #2
0
#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the          #
#  GNU General Public License for more details.                          #
#                                                                        #
#          Copyright 2020 Paul RASCLE www.openfields.fr                  #
#                                                                        #
##########################################################################

import os
import sys
import math
from gendata import getSampleCloud, getSamplePoly, dataDir, isCoordEqual, createSymbolicLinks
import cloudComPy as cc

createSymbolicLinks()  # required for tests on build, before cc.initCC.init
cc.initCC()  # to do once before using plugins or dealing with numpy
cloud = cc.loadPointCloud(getSampleCloud(5.0))

tr1 = cc.ccGLMatrix()
tr1.initFromParameters(0.1, 0.2, 0.3, (8.0, 0.0, 0.0))
box = cc.ccBox((1., 2., 3.), tr1, "aBox")
if box.getName() != 'aBox':
    raise RuntimeError
if box.size() != 12:
    raise RuntimeError

tr2 = cc.ccGLMatrix()
tr2.initFromParameters(0.5, (0., 1., 0.), (5.0, 6.0, 3.0))
cone = cc.ccCone(3., 1., 2., 0., 0., tr2, "aCone", 12)
if cone.getName() != 'aCone':
    raise RuntimeError
if cone.size() != 48:
Beispiel #3
0
#  GNU General Public License for more details.                          #
#                                                                        #
#          Copyright 2020 Paul RASCLE www.openfields.fr                  #
#                                                                        #
##########################################################################

import os
import sys
import math
from gendata import getSampleCloud, dataDir
import numpy as np
import cloudComPy as cc

cc.initCC()  # Sto do once before using plugins or dealing with numpy

cloud1 = cc.loadPointCloud(getSampleCloud(2.0))

ok = cloud1.exportCoordToSF(False, False, True)
if not ok:
    raise RuntimeError

res = cloud1.hasScalarFields()
print("hasScalarField: %s" % res)
if not res:
    raise RuntimeError

n = cloud1.getNumberOfScalarFields()
print("number of saclar fields: %s" % n)
if n != 1:
    raise RuntimeError