Beispiel #1
0
    def tangentAt(self, locationVector=None):
        """
        Compute tangent vector at the specified location.
        :param locationVector: location to use. Use the center point if None
        :return: tangent vector
        """

        curve = self._geomAdaptor()

        if locationVector:
            raise NotImplementedError
        else:
            umin, umax = curve.FirstParameter(), curve.LastParameter()
            umid = 0.5 * (umin + umax)

        # TODO what are good parameters for those?
        curve_props = BRepLProp_CLProps(curve, 2, curve.Tolerance())
        curve_props.SetParameter(umid)

        if curve_props.IsTangentDefined():
            dir_handle = gp_Dir(
            )  # this is awkward due to C++ pass by ref in the API
            curve_props.Tangent(dir_handle)

            return Vector(dir_handle)
Beispiel #2
0
 def __init__(self, instance):
     self.instance = instance
     self._local_props = BRepLProp_CLProps(self.instance.adaptor, 2,
                                           self.instance.tolerance)
Beispiel #3
0
 def __init__(self, instance):
     self.instance = instance
     from OCC.BRepLProp import BRepLProp_CLProps
     # initialize with random parameter: 0
     self._curvature = BRepLProp_CLProps(self.instance.adaptor, 0, 2, self.instance.tolerance)