Skip to content
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

Workplane.spline() Doesn't Support Tangents at Arbitrary Interpolation Points #631

Closed
pavpen opened this issue Feb 12, 2021 · 3 comments
Closed
Labels
enhancement New feature or request OCC feature Requires coding at OCC implementation level

Comments

@pavpen
Copy link
Contributor

pavpen commented Feb 12, 2021

Hello, developers.

The implementation of Workplane.spline, doesn't seem to support specifying tangents for arbitrary interpolation points, but only at the start and end points. The underlying GeomAPI_Interpolate interpolator does support this feature. (It is also exposed in FreeCAD.)

I would like to add this feature to Workplane.spline(), or, perhaps, to a new method, if changing spline() may cause undesirable breakages.

Let me know, if this sounds like a good idea.

Thanks,


Pav

@adam-urbanczyk
Copy link
Member

Hey, absolutely! If you want to implement it, I'd propose to just check the length of the tangents in cq.Workplane.spline and in cq.Edge.makeSpline and act accordingly.

@adam-urbanczyk adam-urbanczyk added OCC feature Requires coding at OCC implementation level enhancement New feature or request labels Feb 12, 2021
@pavpen
Copy link
Contributor Author

pavpen commented Feb 13, 2021

That's what I was doing. I was also adding the parameters argument (I need to figure out how to add some unit tests.):

    @classmethod
    def makeSpline(
        cls: Type["Edge"],
        listOfVector: List[Vector],
        tangents: Optional[Sequence[Vector]] = None,
        periodic: bool = False,
        parameters: Optional[List[float]] = None,
        tol: float = 1e-6,
    ) -> "Edge":
        """
        Interpolate a spline through the provided points.
        :param cls:
        :param listOfVector: a list of Vectors that represent the points
        :param tangents: tuple of Vectors specifying start and finish tangent
        :param periodic: creation of peridic curves
        :param parameters: the value of the parameter at each interpolation point.
            (The intepolated curve is represented as a vector-valued function of a
            scalar parameter.)
                If periodic == True, then len(parameters) must be
            len(intepolation points) + 1, otherwise len(parameters) must be equal to
            len(interpolation points).
        :param tol: tolerance of the algorithm (consult OCC documentation)
                Used to check that the specified points are not too close to each
            other, and that tangent vectors are not too short. (In either case
            interpolation may fail.)
        :return: an Edge
        """

Also, I think passing Scale = False to GeomAPI_Interpolate.Load() would save some unnecessary computation. But that's a minor point.

@marcus7070
Copy link
Member

Closed in #636

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request OCC feature Requires coding at OCC implementation level
Projects
None yet
Development

No branches or pull requests

3 participants