本文整理汇总了Python中point.Point方法的典型用法代码示例。如果您正苦于以下问题:Python point.Point方法的具体用法?Python point.Point怎么用?Python point.Point使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类point
的用法示例。
在下文中一共展示了point.Point方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: regularDogBoneFillet
# 需要导入模块: import point [as 别名]
# 或者: from point import Point [as 别名]
def regularDogBoneFillet(scale: float) ->Outline:
dogBoneF = Outline(None)
dogBoneF.addLinesFromCoordinateList([[82.5, 0], [82.5, 4.5]])
arc = a.Arc(Point(82.5, 4.5), Point(77.5, 9.5), c.CCW, Point(77.5, 4.5), 6) #5mm fillet
dogBoneF.addLineGroup(arc)
dogBoneF.addLinesFromCoordinateList([[77.5, 9.5], [49.642, 9.5]])
arc = a.Arc(Point(49.642, 9.5), Point(28.5, 6.5), c.CW, Point(28.5, 82.5), 20)
dogBoneF.addLineGroup(arc)
dogBoneF.addLinesFromCoordinateList([[28.5, 6.5], [0, 6.5]])
dogBoneF.addLineGroup(dogBoneF.mirror(c.Y))
dogBoneF.addLineGroup(dogBoneF.mirror(c.X))
dogBoneF = dogBoneF.translate(82.5, 9.5)
dogBoneF.finishOutline()
dogBoneF=dogBoneF.scale(scale)
dogBoneF._name = 'regularDogBoneFillet'
return dogBoneF
示例2: typeVDogBone
# 需要导入模块: import point [as 别名]
# 或者: from point import Point [as 别名]
def typeVDogBone(scale: float) ->Outline:
typeV = Outline(None)
typeV.addLinesFromCoordinateList([[31.75, 0], [31.75, 3.77]])
arc=a.Arc(Point(31.75,3.77), Point(30.75,4.77), c.CCW, Point(30.75,3.77),5) #1mm fillet
typeV.addLineGroup(arc)
typeV.addLinesFromCoordinateList([[30.75,4.77], [13.17, 4.77]])
arc=a.Arc(Point(13.17, 4.77), Point(4.77, 1.59), c.CW, Point(4.77, 14.29))
typeV.addLineGroup(arc)
typeV.addLinesFromCoordinateList([[4.77,1.59], [0,1.59]])
typeV.addLineGroup(typeV.mirror(c.Y))
typeV.addLineGroup(typeV.mirror(c.X))
typeV= typeV.translate(31.75, 4.77)
typeV.finishOutline()
typeV=typeV.scale(scale)
typeV._name= 'typeVDogBone'
return typeV
示例3: arcToLines
# 需要导入模块: import point [as 别名]
# 或者: from point import Point [as 别名]
def arcToLines(self):
"""Converts an arc to a set of line segments"""
radius = self.start - self.center
startAngle = math.atan2(self.start.y- self.center.y,
self.start.x - self.center.x)
startAngle = startAngle if startAngle >= 0 else 2*math.pi+startAngle
endAngle = math.atan2(self.end.y- self.center.y,
self.end.x- self.center.x)
endAngle = endAngle if endAngle >= 0 else 2*math.pi+endAngle
includedAngle = self.calcIncludedAngle(startAngle, endAngle)
currentAngle = startAngle
startPoint = Point(self.start.x, self.start.y)
for i in range(self.numPoints-2):
currentAngle += includedAngle/(self.numPoints-1)
x = self.center.x+radius*math.cos(currentAngle)
y = self.center.y+radius*math.sin(currentAngle)
endPoint = Point(x, y)
self.append(Line(startPoint, endPoint))
startPoint = endPoint
endPoint = Point(self.end.x, self.end.y)
self.append(Line(startPoint, endPoint))
示例4: add
# 需要导入模块: import point [as 别名]
# 或者: from point import Point [as 别名]
def add(self, *objects):
for obj in objects:
if isinstance(obj, point.Point):
self.points.append(obj)
elif isinstance(obj, line.Line):
self.lines.append(obj)
elif isinstance(obj, text.Text):
self.text.append(obj)
elif isinstance(obj, point.PointCollection):
self.point_collections.append(obj)
else:
raise TypeError(obj, 'must be a renderable object')
示例5: __init__
# 需要导入模块: import point [as 别名]
# 或者: from point import Point [as 别名]
def __init__(self, pt, text, **kwargs):
self.point = point.Point(pt)
self.text = text
self.options = {'ha':'left', 'va':'top'}
#if self.point.coord[0] == 0:
# self.options['va'] = 'bottom'
#if self.point.coord[1] == 1:
# self.options['ha'] = 'right'
self.options.update(kwargs)
示例6: __init__
# 需要导入模块: import point [as 别名]
# 或者: from point import Point [as 别名]
def __init__(self, pts, label=None, fill=False, **kwargs):
if isinstance(pts, Line):
self = pts
return
self.label = label
self.fill = fill
self.points = [ point.Point(pt) for pt in pts ]
self.options = kwargs
示例7: rand
# 需要导入模块: import point [as 别名]
# 或者: from point import Point [as 别名]
def rand(self):
# A random offset generator
offset = random.random() * self.GUESS_OFFSET
angle = random.random() * 2 * pi
return offset * Point((cos(angle), sin(angle)))
示例8: __init__
# 需要导入模块: import point [as 别名]
# 或者: from point import Point [as 别名]
def __init__(self, KnotVector, points, degree=None):
# The initialization function which takes Knotvector, Control Points and degree(can be excluded) of the B-Spline
self.KnotVector = tuple(KnotVector)
self._points = [Point(p) for p in points]
# Expected degree, if not specified in the constructor
expected_degree = len(self.KnotVector) - len(self._points) - 1
if degree is None:
degree = expected_degree
if degree != expected_degree:
raise ValueError("Degree expected is %s, got %s instead as Input." % (
expected_degree, degree))
self.degree = degree
self.remove_stored()
示例9: test_point_negative
# 需要导入模块: import point [as 别名]
# 或者: from point import Point [as 别名]
def test_point_negative(self):
self.assertTrue(__neg__(p1) == Point(-1.0, -2.0, 3.0))
#self.assertTrue(p1.__neg__ == Point(-1.0, -2.0, 3.0))
#def test_point_greater(self):
# self.assertFalse(__gt__((7, 8, 9)) == False)
示例10: regularDogBone
# 需要导入模块: import point [as 别名]
# 或者: from point import Point [as 别名]
def regularDogBone() ->Outline:
dogBone = Outline(None)
dogBone.addLinesFromCoordinateList([[82.5, 0], [82.5, 9.5], [49.642, 9.5]])
arc = a.Arc(Point(49.642, 9.5), Point(28.5, 6.5), c.CW, Point(28.5, 82.5), 20)
dogBone.addLineGroup(arc)
dogBone.addLinesFromCoordinateList([[28.5, 6.5], [0, 6.5]])
dogBone.addLineGroup(dogBone.mirror(c.Y))
dogBone.addLineGroup(dogBone.mirror(c.X))
dogBone = dogBone.translate(82.5, 9.5)
dogBone.finishOutline()
dogBone._name = 'regularDogBone'
return dogBone
示例11: wideDogBone
# 需要导入模块: import point [as 别名]
# 或者: from point import Point [as 别名]
def wideDogBone(gageWidth: float) ->Outline:
halfWidth = gageWidth / 2.0
wideDogBone = Outline(None)
wideDogBone.addLinesFromCoordinateList([[82.5, 0], [82.5, 9.5 + halfWidth],
[49.642, 9.5 + halfWidth]])
wideArc = a.Arc(Point(49.642, 9.5 + halfWidth),
Point(28.5, 6.5 + halfWidth), c.CW,
Point(28.5, 82.5 + halfWidth), 20)
wideDogBone.addLineGroup(wideArc)
wideDogBone.addLinesFromCoordinateList([[28.5, 6.5 + halfWidth], [0, 6.5 + halfWidth]])
wideDogBone.addLineGroup(wideDogBone.mirror(c.Y))
wideDogBone.addLineGroup(wideDogBone.mirror(c.X))
return wideDogBone.translate(82.5, 9.5 + halfWidth)
示例12: squareWithHole
# 需要导入模块: import point [as 别名]
# 或者: from point import Point [as 别名]
def squareWithHole() ->Outline:
outline = Outline(None)
outline.addLinesFromCoordinateList([[0,0], [50,0], [50,50], [0,50], [0,0]])
circle = a.Arc(Point(35,25), Point(35,25), c.CW, Point(25,25))
outline.addLineGroup(circle)
return outline
示例13: circle
# 需要导入模块: import point [as 别名]
# 或者: from point import Point [as 别名]
def circle(centerX: float, centerY: float, radius: float) ->Outline:
startPoint = Point(centerX+radius, centerY)
center = Point(centerX, centerY)
return Outline(a.Arc(startPoint, startPoint, c.CW, center, numPoints=40))
示例14: rectangle
# 需要导入模块: import point [as 别名]
# 或者: from point import Point [as 别名]
def rectangle(lowerLeftX: float, lowerLeftY: float, X_width: float, Y_height: float) ->Outline:
rect = [Point(lowerLeftX, lowerLeftY)]
rect.append(Point(lowerLeftX+X_width, lowerLeftY))
rect.append(Point(lowerLeftX+X_width, lowerLeftY+Y_height))
rect.append(Point(lowerLeftX, lowerLeftY+Y_height))
rectLG = Outline(None)
rectLG.addLinesFromPoints(rect)
rectLG.closeShape()
return rectLG
示例15: polygon
# 需要导入模块: import point [as 别名]
# 或者: from point import Point [as 别名]
def polygon(centerX: float, centerY: float, radius: float, numCorners: int) ->Outline:
angle = 1.5*math.pi
points = []
incAngle = 2*math.pi/numCorners
for i in range(numCorners):
x = math.cos(angle+incAngle*i)*radius+centerX
y = math.sin(angle+incAngle*i)*radius+centerY
points.append(Point(x,y))
poly = Outline(None)
poly.addLinesFromPoints(points)
poly.closeShape()
poly = poly.rotate(incAngle/2.0, Point(centerX, centerY))
return poly