GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — discussion: transform.tform(points, sharedTransforms=[]) ? · Issue #131 · AllenInstitute/render-python

discussion: transform.tform(points, sharedTransforms=[]) ? #131

New issue
Copy link
New issue
Copy link
Open
Open
discussion: transform.tform(points, sharedTransforms=[]) ?#131
Copy link

Description

@djkapner
djkapner
opened on Dec 12, 2018
Issue body actions

To clean up some fusion something, I created the tform() method for InterpolatedTransform, you can see it below.In this particular case, the InterpolatedTransforms had lists with ReferenceTransforms in them, and rather than de-reference them, I added this kwarg into the call. This breaks the symmetry with all other tform methods, which kind of sucks, but... I was thinking that if all transform.tform() methods had sharedTransforms=[] then we could update ReferenceTransform and TransformList to actually have a tform method. The leaf transforms would need to be able to accept the keyword so the user would not have to worry about what kind of transform he/she is calling.

    def tform(self, points, sharedTransforms=[]):
        """transform a set of points through this transformation
        Parameters
        ----------
        points : numpy.array
            a Nx2 array of x,y points
        Returns
        -------
        numpy.array
            a Nx2 array of x,y points after transformation
        """
        dst = []

        refids = np.array([r.transformId for r in sharedTransforms])

        for ab in [self.a, self.b]:
            dst.append(np.copy(points))
            for tf in ab.tforms:
                if isinstance(tf, ReferenceTransform):
                    rind = np.argwhere(refids == tf.refId).flatten()
                    if rind.size != 1:
                        raise RenderError("Could not find unique "
                                          "sharedTransform for refId %s" %
                                          tf.refId)
                    tf = sharedTransforms[rind[0]]
                dst[-1] = tf.tform(dst[-1])

        return (1.0 - self.lambda_) * dst[0] + self.lambda_ * dst[1]

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402503 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.