-
Notifications
You must be signed in to change notification settings - Fork 35
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Vary inner radius and tenia coli width along colon length #59
Changes from 8 commits
568578d
bd936d1
a4eb98b
cece0cb
5b583bb
0fd56c6
e55561b
90e45e8
1ae7c8f
52d654a
73029a6
c44a641
97a65b5
b1a5935
b12d266
00fc7e2
3e48b5e
a1d183b
7fa7545
4e38e01
9fa3beb
5156eb9
8d9427c
975f39a
f6b4d55
912800b
8c6db49
e8a9300
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,8 +6,8 @@ | |
|
||
import copy | ||
from scaffoldmaker.meshtypes.meshtype_1d_path1 import MeshType_1d_path1, extractPathParametersFromRegion | ||
from scaffoldmaker.meshtypes.meshtype_3d_colonsegmentsimplemesentery1 import MeshType_3d_colonsegmentsimplemesentery1, getColonSegmentInnerPointsNoTeniaColi | ||
from scaffoldmaker.meshtypes.meshtype_3d_colonsegmentteniacoli1 import MeshType_3d_colonsegmentteniacoli1, getColonSegmentInnerPointsTeniaColi, getTeniaColi | ||
from scaffoldmaker.meshtypes.meshtype_3d_colonsegmentsimplemesentery1 import MeshType_3d_colonsegmentsimplemesentery1, TubeMeshSegmentInnerPointsNoTeniaColi | ||
from scaffoldmaker.meshtypes.meshtype_3d_colonsegmentteniacoli1 import MeshType_3d_colonsegmentteniacoli1, TubeMeshSegmentInnerPointsTeniaColi, getTeniaColi | ||
from scaffoldmaker.meshtypes.scaffold_base import Scaffold_base | ||
from scaffoldmaker.scaffoldpackage import ScaffoldPackage | ||
from scaffoldmaker.utils.meshrefinement import MeshRefinement | ||
|
@@ -66,19 +66,32 @@ class MeshType_3d_colon1(Scaffold_base): | |
'scaffoldSettings' : { | ||
'Coordinate dimensions' : 3, | ||
'Length' : 1.0, | ||
'Number of elements' : 8 | ||
'Number of elements' : 7 | ||
}, | ||
'meshEdits' : zinc_utils.exnodeStringFromNodeValues( | ||
[ Node.VALUE_LABEL_VALUE, Node.VALUE_LABEL_D_DS1, Node.VALUE_LABEL_D_DS2, Node.VALUE_LABEL_D2_DS1DS2 ], [ | ||
[ [ 0.0, 0.0, 0.0 ], [ 0.6, 1.2, -0.2 ], [ 0.2, 0.1, 0.2 ], [ 0.6, 0.0, 0.30 ] ], | ||
[ [ -0.2, 1.1, -0.3 ], [ -0.8, 0.4, 0.9 ], [ 0.2, 0.2, 0.1 ], [ 0.0, 0.1, 0.20 ] ], | ||
[ [ -0.3, 0.2, 0.3 ], [ -0.4, -0.8, 0.0 ], [ 0.2, -0.1, 0.2 ], [ 0.1, 0.0, 0.20 ] ], | ||
[ [ -1.1, -0.3, -0.4 ], [ -0.8, -0.3, -0.7 ], [ 0.1, -0.2, 0.1 ], [ 0.0, 0.0, 0.05 ] ], | ||
[ [ -1.6, -0.4, 0.0 ], [ 0.4, -0.3, 1.4 ], [ 0.1, -0.3, 0.0 ], [ 0.0, 0.0, 0.05 ] ], | ||
[ [ -0.7, -0.8, 0.0 ], [ 0.5, -0.1, -1.4 ], [ 0.0, -0.3, 0.0 ], [ 0.0, 0.0, 0.05 ] ], | ||
[ [ -0.1, -0.6, -0.1 ], [ 0.2, -0.2, 0.9 ], [ 0.1, -0.3, -0.1 ], [ 0.0, 0.0, 0.05 ] ], | ||
[ [ -0.2, -1.4, 0.5 ], [ -0.2, -0.4, 0.2 ], [ 0.1, -0.2, -0.2 ], [ 0.0, 0.0, 0.05 ] ] ] ) | ||
} ), | ||
'Mouse 2' : ScaffoldPackage(MeshType_1d_path1, { | ||
'scaffoldSettings' : { | ||
'Coordinate dimensions' : 3, | ||
'Length' : 1.0, | ||
'Number of elements' : 4 | ||
}, | ||
'meshEdits' : zinc_utils.exnodeStringFromNodeValues( | ||
[ Node.VALUE_LABEL_VALUE, Node.VALUE_LABEL_D_DS1, Node.VALUE_LABEL_D_DS2, Node.VALUE_LABEL_D2_DS1DS2 ], [ | ||
[ [ 0.3, -0.2, -0.6 ], [ 0.4, 1.3, -0.1 ], [ -0.1, 0.1, 0.4 ], [ 0.0, 0.0, 0.05 ] ], | ||
[ [ 0.2, 1.4, -0.7 ], [ -1.9, -0.3, -0.5 ], [ -0.1, 0.0, 0.4 ], [ 0.0, 0.0, 0.05 ] ], | ||
[ [ -0.6, -0.3, -0.9 ], [ -2.8, 0.0, -1.4 ], [ -0.3, 0.0, 0.2 ], [ 0.0, 0.0, 0.05 ] ], | ||
[ [ -2.0, 0.8, -2.2 ], [ -1.8, 0.1, 0.0 ], [ 0.0, 0.0, 0.5 ], [ 0.0, 0.0, 0.05 ] ], | ||
[ [ -2.6, 0.0, -1.6 ], [ 0.7, -1.2, 1.0 ], [ 0.0, 0.0, 0.5 ], [ 0.0, 0.0, 0.05 ] ], | ||
[ [ -0.9, -0.9, -1.6 ], [ 1.3, 0.5, -1.6 ], [ 0.0, 0.3, 0.5 ], [ 0.0, 0.0, 0.05 ] ], | ||
[ [ -0.3, 0.6, -1.7 ], [ 3.1, 0.3, 0.5 ], [ -0.2, 0.0, 0.2 ], [ 0.0, 0.0, 0.05 ] ], | ||
[ [ 0.1, -1.0, -0.7 ], [ -0.3, -0.7, 0.4 ], [ 0.0, 0.0, 0.5 ], [ 0.0, 0.0, 0.05 ] ], | ||
[ [ -0.4, -2.3, -0.1 ], [ -0.4, -0.6, 0.3 ], [ 0.0, 0.0, 0.5 ], [ 0.0, 0.0, 0.05 ] ] ] ) | ||
[ [ 0.0, 0.0, 0.0 ], [ 0.0, 0.0, 1.3 ], [ 0.0, -1.0, 0.0 ], [ 0.0, 0.0, 0.05 ] ], | ||
[ [ 0.0, 0.0, 1.3 ], [ 0.0, 0.2, 2.8 ], [ 0.0, -1.0, 0.0 ], [ 0.0, 0.0, 0.05 ] ], | ||
[ [ -1.4, -0.2, 1.3 ], [ 0.0, -0.3, -1.9 ], [ 0.0, -1.0, 0.0 ], [ 0.0, 0.0, 0.05 ] ], | ||
[ [ -1.4, -0.1, -1.0 ], [ 0.1, 0.1, -1.7 ], [ 0.0, -1.0, 0.0 ], [ 0.0, 0.0, 0.05 ] ], | ||
[ [ -1.4, 0.0, -2.8 ], [ 0.0, 0.0, -1.1 ], [ 0.0, -1.0, 0.0 ], [ 0.0, 0.0, 0.05 ] ] ] ) | ||
} ), | ||
'Pig 1' : ScaffoldPackage(MeshType_1d_path1, { | ||
'scaffoldSettings' : { | ||
|
@@ -157,14 +170,17 @@ def getParameterSetNames(): | |
'Human 1', | ||
'Human 2', | ||
'Mouse 1', | ||
'Mouse 2', | ||
'Pig 1'] | ||
|
||
@classmethod | ||
def getDefaultOptions(cls, parameterSetName='Default'): | ||
if 'Human 2' in parameterSetName: | ||
centralPathOption = cls.centralPathDefaultScaffoldPackages['Human 2'] | ||
elif 'Mouse' in parameterSetName: | ||
elif 'Mouse 1' in parameterSetName: | ||
centralPathOption = cls.centralPathDefaultScaffoldPackages['Mouse 1'] | ||
elif 'Mouse 2' in parameterSetName: | ||
centralPathOption = cls.centralPathDefaultScaffoldPackages['Mouse 2'] | ||
elif 'Pig' in parameterSetName: | ||
centralPathOption = cls.centralPathDefaultScaffoldPackages['Pig 1'] | ||
else: | ||
|
@@ -179,13 +195,48 @@ def getDefaultOptions(cls, parameterSetName='Default'): | |
'Central path' : copy.deepcopy(centralPathOption), | ||
'Segment profile' : segmentProfileOption, | ||
'Number of segments': 30, | ||
'Proximal length': 12.0, | ||
'Transverse length': 13.0, | ||
'Distal length': 20.0, | ||
'Proximal inner radius': 0.8, | ||
'Proximal tenia coli width': 0.2, | ||
'Proximal-transverse inner radius': 1.1, | ||
'Proximal-transverse tenia coli width': 0.2, | ||
'Transverse-distal inner radius': 1.25, | ||
'Transverse-distal tenia coli width': 0.2, | ||
'Distal inner radius': 1.5, | ||
'Distal tenia coli width': 0.2, | ||
'Refine' : False, | ||
'Refine number of elements around' : 1, | ||
'Refine number of elements along' : 1, | ||
'Refine number of elements through wall' : 1 | ||
} | ||
if 'Pig' in parameterSetName: | ||
if 'Mouse' in parameterSetName: | ||
options['Number of segments'] = 10 | ||
options['Proximal length'] = 3.0 | ||
options['Transverse length'] = 2.0 | ||
options['Distal length'] = 2.5 | ||
options['Proximal inner radius'] = 0.1 | ||
options['Proximal tenia coli width'] = 0.05 | ||
options['Proximal-transverse inner radius'] = 0.09 | ||
options['Proximal-transverse tenia coli width'] = 0.07 | ||
options['Transverse-distal inner radius'] = 0.07 | ||
options['Transverse-distal tenia coli width'] = 0.1 | ||
options['Distal inner radius'] = 0.07 | ||
options['Distal tenia coli width'] = 0.1 | ||
elif 'Pig' in parameterSetName: | ||
options['Number of segments'] = 120 | ||
options['Proximal length'] = 50.0 | ||
options['Transverse length'] = 80.0 | ||
options['Distal length'] = 70.0 | ||
options['Proximal inner radius'] = 0.9 | ||
options['Proximal tenia coli width'] = 0.2 | ||
options['Proximal-transverse inner radius'] = 0.9 | ||
options['Proximal-transverse tenia coli width'] = 0.2 | ||
options['Transverse-distal inner radius'] = 0.9 | ||
options['Transverse-distal tenia coli width'] = 0.2 | ||
options['Distal inner radius'] = 0.9 | ||
options['Distal tenia coli width'] = 0.2 | ||
return options | ||
|
||
@staticmethod | ||
|
@@ -194,6 +245,17 @@ def getOrderedOptionNames(): | |
'Central path', | ||
'Segment profile', | ||
'Number of segments', | ||
'Proximal length', | ||
'Transverse length', | ||
'Distal length', | ||
'Proximal inner radius', | ||
'Proximal tenia coli width', | ||
'Proximal-transverse inner radius', | ||
'Proximal-transverse tenia coli width', | ||
'Transverse-distal inner radius', | ||
'Transverse-distal tenia coli width', | ||
'Distal inner radius', | ||
'Distal tenia coli width', | ||
'Refine', | ||
'Refine number of elements around', | ||
'Refine number of elements along', | ||
|
@@ -248,6 +310,20 @@ def checkOptions(cls, options): | |
'Refine number of elements through wall']: | ||
if options[key] < 1: | ||
options[key] = 1 | ||
for key in [ | ||
'Proximal length', | ||
'Transverse length', | ||
'Distal length', | ||
'Proximal inner radius', | ||
'Proximal tenia coli width', | ||
'Proximal-transverse inner radius', | ||
'Proximal-transverse tenia coli width', | ||
'Transverse-distal inner radius', | ||
'Transverse-distal tenia coli width', | ||
'Distal inner radius', | ||
'Distal tenia coli width']: | ||
if options[key] < 0.0: | ||
options[key] = 0.0 | ||
|
||
@staticmethod | ||
def generateBaseMesh(region, options): | ||
|
@@ -260,14 +336,24 @@ def generateBaseMesh(region, options): | |
centralPath = options['Central path'] | ||
segmentProfile = options['Segment profile'] | ||
segmentCount = options['Number of segments'] | ||
proximalLength = options['Proximal length'] | ||
transverseLength = options['Transverse length'] | ||
distalLength = options['Distal length'] | ||
proximalInnerRadius = options['Proximal inner radius'] | ||
proximalTCWidth = options['Proximal tenia coli width'] | ||
proximalTransverseInnerRadius = options['Proximal-transverse inner radius'] | ||
proximalTransverseTCWidth = options['Proximal-transverse tenia coli width'] | ||
transverseDistalInnerRadius = options['Transverse-distal inner radius'] | ||
transverseDistalTCWidth = options['Transverse-distal tenia coli width'] | ||
distalInnerRadius = options['Distal inner radius'] | ||
distalTCWidth = options['Distal tenia coli width'] | ||
segmentScaffoldType = segmentProfile.getScaffoldType() | ||
segmentSettings = segmentProfile.getScaffoldSettings() | ||
|
||
if segmentScaffoldType == MeshType_3d_colonsegmentsimplemesentery1: | ||
elementsCountAroundMZ = segmentSettings['Number of elements around mesenteric zone'] | ||
elementsCountAroundNonMZ = segmentSettings['Number of elements around non-mesenteric zone'] | ||
elementsCountAround = elementsCountAroundMZ + elementsCountAroundNonMZ | ||
mzWidth = segmentSettings['Mesenteric zone width'] | ||
else: # segmentScaffoldType == MeshType_3d_colonsegmentteniacoli1: | ||
elementsCountAroundTC = segmentSettings['Number of elements around tenia coli'] | ||
elementsCountAroundHaustrum = segmentSettings['Number of elements around haustrum'] | ||
|
@@ -276,13 +362,15 @@ def generateBaseMesh(region, options): | |
segmentLengthEndDerivativeFactor = segmentSettings['Segment length end derivative factor'] | ||
segmentLengthMidDerivativeFactor = segmentSettings['Segment length mid derivative factor'] | ||
tcCount = segmentSettings['Number of tenia coli'] | ||
tcWidth = segmentSettings['Tenia coli width'] | ||
tcThickness = segmentSettings['Tenia coli thickness'] | ||
elementsCountAround = (elementsCountAroundTC + elementsCountAroundHaustrum)*tcCount | ||
|
||
elementsCountAlongSegment = segmentSettings['Number of elements along segment'] | ||
elementsCountThroughWall = segmentSettings['Number of elements through wall'] | ||
radius = segmentSettings['Inner radius'] | ||
startRadius = segmentSettings['Start inner radius'] | ||
startRadiusDerivative = segmentSettings['Start radius derivative'] | ||
endRadius = segmentSettings['End inner radius'] | ||
endRadiusDerivative = segmentSettings['End radius derivative'] | ||
wallThickness = segmentSettings['Wall thickness'] | ||
useCrossDerivatives = segmentSettings['Use cross derivatives'] | ||
useCubicHermiteThroughWall = not(segmentSettings['Use linear through wall']) | ||
|
@@ -291,6 +379,11 @@ def generateBaseMesh(region, options): | |
tmpRegion = region.createRegion() | ||
centralPath.generate(tmpRegion) | ||
cx, cd1, cd2, cd12 = extractPathParametersFromRegion(tmpRegion) | ||
# for i in range(len(cx)): | ||
# print('cx = ', i+1, cx[i]) | ||
# print('cd1 = ', i+1, cd1[i]) | ||
# print('cd2 = ', i+1, cd2[i]) | ||
# print('cd12 = ', i+1, cd12[i]) | ||
del tmpRegion | ||
|
||
# find arclength of colon | ||
|
@@ -302,28 +395,38 @@ def generateBaseMesh(region, options): | |
arcLength = interp.getCubicHermiteArcLength(cx[e], sd1[e], cx[e + 1], sd1[e + 1]) | ||
length += arcLength | ||
segmentLength = length / segmentCount | ||
# print('Length = ', length) | ||
|
||
# Generate variation of radius & tc width along length | ||
lengthList = [0.0, proximalLength, proximalLength + transverseLength, length] | ||
innerRadiusList = [proximalInnerRadius, proximalTransverseInnerRadius, transverseDistalInnerRadius, distalInnerRadius] | ||
|
||
innerRadiusSegmentList, dInnerRadiusSegmentList = sampleParameterAlongLength(innerRadiusList, lengthList, segmentCount) | ||
tcWidthList = [proximalTCWidth, proximalTransverseTCWidth, transverseDistalTCWidth, distalTCWidth] | ||
tcWidthSegmentList, dTCWidthSegmentList = sampleParameterAlongLength(tcWidthList, lengthList, segmentCount) | ||
|
||
# Generate inner surface of a colon segment | ||
if segmentScaffoldType == MeshType_3d_colonsegmentsimplemesentery1: | ||
annotationGroups, annotationArray, transitElementList, uList, arcLengthOuterMidLength, xInner, d1Inner, d2Inner, segmentAxis = getColonSegmentInnerPointsNoTeniaColi(region, elementsCountAroundMZ, elementsCountAroundNonMZ, | ||
elementsCountAlongSegment, mzWidth, radius, segmentLength, wallThickness) | ||
tubeMeshSegmentInnerPoints = TubeMeshSegmentInnerPointsNoTeniaColi(region, elementsCountAroundMZ, | ||
elementsCountAroundNonMZ, elementsCountAlongSegment, segmentLength, wallThickness) | ||
|
||
else: # segmentScaffoldType == MeshType_3d_colonsegmentteniacoli1: | ||
annotationGroups, annotationArray, transitElementList, uList, arcLengthOuterMidLength, xInner, d1Inner, d2Inner, segmentAxis = getColonSegmentInnerPointsTeniaColi(region, elementsCountAroundTC, elementsCountAroundHaustrum, | ||
elementsCountAlongSegment, tcCount, tcWidth, radius, cornerInnerRadiusFactor, haustrumInnerRadiusFactor, | ||
segmentLengthEndDerivativeFactor, segmentLengthMidDerivativeFactor, segmentLength, wallThickness) | ||
tubeMeshSegmentInnerPoints = TubeMeshSegmentInnerPointsTeniaColi(region, | ||
elementsCountAroundTC, elementsCountAroundHaustrum, elementsCountAlongSegment, | ||
tcCount, segmentLengthEndDerivativeFactor, segmentLengthMidDerivativeFactor, | ||
segmentLength, wallThickness, cornerInnerRadiusFactor, haustrumInnerRadiusFactor) | ||
|
||
# Generate tube mesh | ||
annotationGroups, nextNodeIdentifier, nextElementIdentifier, xList, d1List, d2List, d3List, sx, curvatureAlong, factorList = tubemesh.generatetubemesh(region, | ||
elementsCountAround, elementsCountAlongSegment, elementsCountThroughWall, segmentCount, cx, cd1, cd2, cd12, | ||
xInner, d1Inner, d2Inner, wallThickness, segmentAxis, segmentLength, useCrossDerivatives, useCubicHermiteThroughWall, | ||
annotationGroups, annotationArray, transitElementList, uList, arcLengthOuterMidLength) | ||
annotationGroups, nextNodeIdentifier, nextElementIdentifier, xList, d1List, d2List, d3List, sx, curvatureAlong, factorList, uList, relaxedLengthList, tubeTCWidthList = tubemesh.generatetubemesh(region, | ||
elementsCountAround, elementsCountAlongSegment, elementsCountThroughWall, segmentCount, cx, cd1, cd2, cd12, innerRadiusSegmentList, dInnerRadiusSegmentList, | ||
tcWidthSegmentList, dTCWidthSegmentList, tubeMeshSegmentInnerPoints, wallThickness, segmentLength, useCrossDerivatives, useCubicHermiteThroughWall) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can't pass TC width here - see comments on tubemesh class. |
||
|
||
# Generate tenia coli | ||
if segmentScaffoldType == MeshType_3d_colonsegmentteniacoli1: | ||
annotationGroupsTC, nextNodeIdentifier, nextElementIdentifier = getTeniaColi(region, nextNodeIdentifier, nextElementIdentifier, | ||
useCrossDerivatives, useCubicHermiteThroughWall, xList, d1List, d2List, d3List, elementsCountAroundTC, elementsCountAroundHaustrum, | ||
elementsCountAlong, elementsCountThroughWall, wallThickness, tcWidth, tcThickness, sx, curvatureAlong, factorList, uList, | ||
arcLengthOuterMidLength, length, tcCount) | ||
useCrossDerivatives, useCubicHermiteThroughWall, xList, d1List, d2List, d3List, segmentCount, elementsCountAroundTC, elementsCountAroundHaustrum, | ||
elementsCountAlong, elementsCountThroughWall, wallThickness, tubeTCWidthList, tcThickness, sx, curvatureAlong, factorList, | ||
length, tcCount, uList, relaxedLengthList) | ||
|
||
annotationGroups += annotationGroupsTC | ||
|
||
|
@@ -350,3 +453,59 @@ def generateMesh(cls, region, options): | |
meshrefinement = MeshRefinement(baseRegion, region, baseAnnotationGroups) | ||
meshrefinement.refineAllElementsCubeStandard3d(refineElementsCountAround, refineElementsCountAlong, refineElementsCountThroughWall) | ||
return meshrefinement.getAnnotationGroups() | ||
|
||
def sampleParameterAlongLength(paramList, lengthList, segmentCount): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As written this function is general purpose so could go in tubemesh? But read comments below first... |
||
""" | ||
Generate parameter value and rate of change at segment intersections | ||
along total length. Parameter is assumed to vary with a cubic hermite | ||
function. | ||
:param paramList: List of parameter values at length locations specified | ||
in lengthList. | ||
:param lengthList: List of length locations. | ||
:param segmentCount: Number of segments along total length. | ||
:return paramList, dParamList: Parameter values and rate of change at each segment. | ||
""" | ||
|
||
nx = [] | ||
nd1 = [] | ||
xList = [] | ||
d1List = [] | ||
for i in range(len(lengthList)): | ||
v = [lengthList[i], paramList[i], 0.0] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No need for 3rd component for v and d1 as smooth function handles n components. |
||
d1 = [(lengthList[i+1] - lengthList[i]) if i < len(lengthList)-1 else (lengthList[i] - lengthList[i-1]), 0.0, 0.0] | ||
nx.append(v) | ||
nd1.append(d1) | ||
smoothd1 = interp.smoothCubicHermiteDerivativesLine(nx, nd1) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Alternatively, could have proximal, (mid) transverse and distal parameters and assume zero derivatives? That would make this function colon-specific. What are researchers likely to measure? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Discussed offline with Richard. Decided to keep things as they are now and will modify later when requirements change. |
||
|
||
# Get total arclength | ||
arcLength = 0.0 | ||
for e in range(len(nx)-1): | ||
arcLength += interp.getCubicHermiteArcLength(nx[e], smoothd1[e], nx[e + 1], smoothd1[e + 1]) | ||
|
||
# Find parameter value at each segment | ||
xTol = 1.0E-6 | ||
for n in range(segmentCount + 1): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Isn't this loop the same as interp.sampleCubicHermiteCurves (also interp.sampleCubicHermiteCurvesSmooth)? These would be more efficient than using getCubicHermiteCurvesPointsAtArcDistance... There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. interp.sampleCubicHermiteCurves will sample the curve describing how parameter changes along the centre line into equal arclength, but here I want to sample along the center line and get the parameter value along each of these points on the center line. |
||
arcStart = 0.0 | ||
arcEnd = arcLength | ||
xi = 1.0/segmentCount * n | ||
for iter in range(100): | ||
arcDistance = (arcStart + arcEnd)*0.5 | ||
x, d1, _, _ = interp.getCubicHermiteCurvesPointAtArcDistance(nx, smoothd1, arcDistance) | ||
diff = x[0] - xi*lengthList[-1] | ||
if abs(diff) > xTol: | ||
if diff < 0.0: | ||
arcStart = arcDistance | ||
else: | ||
arcEnd = arcDistance | ||
else: | ||
xList.append(x) | ||
d1List.append(d1) | ||
break | ||
if iter > 99: | ||
print('Search for sampleParameterAlongLength - Max iters reached:',iter) | ||
smoothdList = interp.smoothCubicHermiteDerivativesLine(xList, d1List) | ||
|
||
paramList = [c[1] for c in xList] | ||
dParamList = [c[1] for c in smoothdList] | ||
|
||
return paramList, dParamList |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can't return anything specific to a segment profile from this function either (relaxedLengthList, tubeTCWidthList; not sure what ulist is). Probable solution is to store these in the tubeMeshSegmentInnerPoints? Alternative is to return a generic map of names to lists of values.