コード例 #1
0
P0 = (0, 0, 1)
P1 = (5, 0, 1)
P2 = (0, 7, 1)
P3 = (5, 7, 1)

# Geometrie
d1 = D.line(P0, P1)
d2 = D.line(P2, P3)

P0 = (0, 0, 1)
P1 = (-2, 2, 1)
P2 = (-3, 3, 1)
P3 = (2, 5, 1)
P4 = (0, 7, 1)
pts = D.polyline([P0, P1, P2, P3, P4])
b1 = D.bezier(pts)

P0 = (5, 0, 1)
P1 = (3, 2, 1)
P2 = (2, 3, 1)
P3 = (6, 5, 1)
P4 = (5, 7, 1)
pts = D.polyline([P0, P1, P2, P3, P4])
b2 = D.bezier(pts)

# Discretisation reguliere de chaque ligne
Ni = 20
Nj = 10
r = G.cart((0, 0, 0), (1. / (Ni - 1), 1, 1), (Ni, 1, 1))
q = G.cart((0, 0, 0), (1. / (Nj - 1), 1, 1), (Nj, 1, 1))
r1 = G.map(d1, r)
コード例 #2
0
#!/usr/bin/env python
# coding: utf-8
r"""bezier (pyTree)"""

import Geom.PyTree as D
import Converter.PyTree as C

# Bezier 1D
pts = D.polyline([(0., 0., 0.), (0., 1., 0.), (2., 1., 0.), (2., 0., 0.),
                  (4., -1., 0.), (5., 6., 0.)])
a = D.bezier(pts, 100)
a[0] = 'bezier'
C.convertPyTree2File(a, 'out.cgns')
コード例 #3
0
# - mapCurvature (pyTree) -
import Generator.PyTree as G
import Converter.PyTree as C
import Geom.PyTree as D

ni = 2
nj = 3
a = G.cart((0, 0, 0), (1, 1, 1), (ni, nj, 1))
C.setValue(a, 'GridCoordinates', (1, 1, 1), [1., 1., 2.])
C.setValue(a, 'GridCoordinates', (1, 2, 1), [1., 2., 5.])
C.setValue(a, 'GridCoordinates', (1, 3, 1), [1., 3., 2.])
C.setValue(a, 'GridCoordinates', (2, 1, 1), [2., 1., 2.])
C.setValue(a, 'GridCoordinates', (2, 2, 1), [2., 2., 5.])
C.setValue(a, 'GridCoordinates', (2, 3, 1), [2., 3., 2.])
b = D.bezier(a, density=10.)

b = G.mapCurvature(b, N=100, power=0.5, dir=1)

C.convertPyTree2File(b, 'out.cgns')
コード例 #4
0
# - bezier (pyTree) -
import Geom.PyTree as D
import Converter.PyTree as C
import Generator.PyTree as G
import KCore.test as test

# Bezier 1D
pts = D.polyline([(0.,0.,0.), (0.,1.,0.), (2.,1.,0.), (2.,0.,0.),\
                  (4.,-1.,0.), (5.,6.,0.),])
a = D.bezier(pts, 100); a[0] = 'bezier'
t = C.newPyTree(['Base',1]); t[2][1][2].append(a)
test.testT(t, 1)

# 2D
ni = 2; nj = 3
a = G.cart((0,0,0), (1,1,1), (ni,nj,1))
C.setValue(a,'GridCoordinates', (1,1,1), [1.,1.,2.])
C.setValue(a,'GridCoordinates', (1,2,1), [1.,2.,5.])
C.setValue(a,'GridCoordinates', (1,3,1), [1.,3.,2.])
C.setValue(a,'GridCoordinates', (2,1,1), [2.,1.,2.])
C.setValue(a,'GridCoordinates', (2,2,1), [2.,2.,5.])
C.setValue(a,'GridCoordinates', (2,3,1), [2.,3.,2.])
b = D.bezier(a, 10, 10)
test.testT([b],2)
test.writeCoverage(100)
コード例 #5
0
# - bezier (pyTree) -
import Geom.PyTree as D
import Converter.PyTree as C

# Bezier 1D
pts = D.polyline([(0.,0.,0.), (0.,1.,0.), (2.,1.,0.), (2.,0.,0.),
                  (4.,-1.,0.), (5.,6.,0.),])
a = D.bezier(pts, 100); a[0] = 'bezier'
C.convertPyTree2File(a, 'out.cgns')