本文整理汇总了Python中Wrappers.frange6方法的典型用法代码示例。如果您正苦于以下问题:Python Wrappers.frange6方法的具体用法?Python Wrappers.frange6怎么用?Python Wrappers.frange6使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Wrappers
的用法示例。
在下文中一共展示了Wrappers.frange6方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: makeFillEdges2d
# 需要导入模块: import Wrappers [as 别名]
# 或者: from Wrappers import frange6 [as 别名]
def makeFillEdges2d(xMin, yMin, xMax, yMax, spacing):
"make straight hatch lines."
edges = []
for y in Wrappers.frange6(yMin, yMax, spacing):
e = edgeFromTwoPoints((xMin, y), (xMax, y))
# TestDisplay.display.showShape(e);
edges.append(e)
return edges
示例2: scanlinesFromBoundingBox
# 需要导入模块: import Wrappers [as 别名]
# 或者: from Wrappers import frange6 [as 别名]
def scanlinesFromBoundingBox(boundingBox,interval):
(xMin,yMin,zMin,xMax,yMax,zMax) = boundingBox;
print boundingBox;
edges = [];
for y in Wrappers.frange6(yMin,yMax,interval):
e = Wrappers.edgeFromTwoPoints(gp.gp_Pnt(xMin,y,0),gp.gp_Pnt(xMax,y,0));
#TestDisplay.display.showShape(e);
edges.append((y,Wrappers.wireFromEdges([e])));
return edges;
示例3: makeFillCurves2d
# 需要导入模块: import Wrappers [as 别名]
# 或者: from Wrappers import frange6 [as 别名]
def makeFillCurves2d(xMin, yMin, xMax, yMax, spacing):
"""
makes a set of lines that are curves not edges
probably the minimal possible construction
"""
lines = []
for y in Wrappers.frange6(yMin, yMax, spacing):
l = GCE2d.GCE2d_MakeSegment(tP(xMin, y), tP(xMax, y)).Value()
lines.append(l)
return lines
示例4: computePixelGrid
# 需要导入模块: import Wrappers [as 别名]
# 或者: from Wrappers import frange6 [as 别名]
def computePixelGrid(face, resolution=0.1):
"""
makes a pixel grid of a face at the requested resolution."
A dictionary is used to store the values.
"""
box = Bnd.Bnd_Box();
b = BRepBndLib.BRepBndLib();
b.Add(face,box);
TOLERANCE = 5;
bounds = box.Get();
xMin = bounds[0];
xMax = bounds[3];
xDim = abs(xMax - xMin);
yMin = bounds[1];
yMax = bounds[4];
yDim = abs(yMax - yMin);
zMin = bounds[2];
pixelTable = {};
for y in Wrappers.frange6(yMin,yMax,resolution):
#create a horizontal scan line
edge = Wrappers.edgeFromTwoPoints(
gp.gp_Pnt(xMin - TOLERANCE,y,zMin),
gp.gp_Pnt(xMax + TOLERANCE,y,zMin) );
#get list of wires from the face
#TODO:// this should be encapsulated by a face abstraction
wires = []
ow = brt.OuterWire(face);
wires.append(ow);
for w in Topo(face).wires():
if not w.IsSame(ow):
wires.append(w);
#compute intersection points with each wire
#this is a hack because i know how to make edges from lines
#but really, it would be better to do 2d here and use
#Geom2dAPI_InterCurveCurve
xIntersections = [];
for w in wires:
#display.DisplayShape(w);
brp = BRepExtrema.BRepExtrema_DistShapeShape();
#display.DisplayShape(edge);
brp.LoadS1(w);
brp.LoadS2(edge);
if brp.Perform() and brp.Value() < 0.01:
for k in range(1,brp.NbSolution()+1):
if brp.SupportTypeShape1(k) == BRepExtrema.BRepExtrema_IsOnEdge:
xIntersections.append(brp.PointOnShape1(k).X() );
if len(xIntersections) == 0:
print "No intersection found.";
continue;
#else:
#print "there are %d intersections " % len(xIntersections);
#sort intersection points by x value
xIntersections.sort();
#fill pixel table with values on surface based on scanlines
#TODO: for now ignore horizontals and edge vertices, this is just a test
#better to use a generator here too
#also need to implement edge table of scanline fill
if (len(xIntersections) % 2 == 0) :
i = 0;
inside = False;
cx = xMin;
#print xIntersections;
while i < len(xIntersections):
cint = xIntersections[i];
if inside:
while cx < cint:
key = ( cx, y );
pixelTable[key] = 1;
#print cx;
cx += resolution;
else:
while cx<cint:
cx += resolution;
#print cx;
continue;
i += 1;
inside = not inside;
else:
print "Odd number of intersections encountred."
#displayPixelGrid(pixelTable);
return pixelTable;