30 |
|
|
31 |
|
|
32 |
def resetGlobalPrimitiveIdCounter(): |
def resetGlobalPrimitiveIdCounter(): |
33 |
|
""" |
34 |
|
initializes the global primitive ID counter |
35 |
|
""" |
36 |
global global_primitive_id_counter |
global global_primitive_id_counter |
37 |
global_primitive_id_counter=1 |
global_primitive_id_counter=1 |
38 |
|
|
39 |
def setToleranceForColocation(tol=1.e-11): |
def setToleranceForColocation(tol=1.e-11): |
40 |
|
""" |
41 |
|
set the global tolerance for colocation checks to tol |
42 |
|
""" |
43 |
global global_tolerance_for_colocation |
global global_tolerance_for_colocation |
44 |
global_tolerance_for_colocation=tol |
global_tolerance_for_colocation=tol |
45 |
|
|
46 |
def getToleranceForColocation(): |
def getToleranceForColocation(): |
47 |
|
""" |
48 |
|
returns the global tolerance for colocation checks |
49 |
|
""" |
50 |
return global_tolerance_for_colocation |
return global_tolerance_for_colocation |
51 |
|
|
52 |
resetGlobalPrimitiveIdCounter() |
resetGlobalPrimitiveIdCounter() |
431 |
|
|
432 |
class Arc(Primitive1D): |
class Arc(Primitive1D): |
433 |
""" |
""" |
434 |
defines an arc |
defines an arc which is strictly, smaller than Pi |
435 |
""" |
""" |
436 |
def __init__(self,center,start,end): |
def __init__(self,center,start,end): |
437 |
""" |
""" |
438 |
creates an arc by the start point, end point and center |
creates an arc by the start point, end point and center |
439 |
""" |
""" |
440 |
if isinstance(center,Point): raise TypeError("center needs to be a Point object.") |
if not isinstance(center,Point): raise TypeError("center needs to be a Point object.") |
441 |
if isinstance(end,Point): raise TypeError("end needs to be a Point object.") |
if not isinstance(end,Point): raise TypeError("end needs to be a Point object.") |
442 |
if isinstance(start,Point): raise TypeError("start needs to be a Point object.") |
if not isinstance(start,Point): raise TypeError("start needs to be a Point object.") |
443 |
|
# TODO: check length of circle. |
444 |
super(Arc, self).__init__() |
super(Arc, self).__init__() |
445 |
self.__center=center |
self.__center=center |
446 |
self.__start=start |
self.__start=start |
466 |
|
|
467 |
def getPrimitives(self): |
def getPrimitives(self): |
468 |
""" |
""" |
469 |
returns C{set} of primitive used to construct the Curve |
returns the primitives used to construct the Curve |
470 |
""" |
""" |
471 |
out=set() |
out=set() |
472 |
out|=set(self.getStartPoint().getPrimitives()) |
out|=set(self.getStartPoint().getPrimitives()) |
505 |
else: |
else: |
506 |
return False |
return False |
507 |
|
|
|
|
|
508 |
#================================================================================================================================= |
#================================================================================================================================= |
509 |
class CurveLoop(Primitive): |
class CurveLoop(Primitive): |
510 |
""" |
""" |