vkit.mechanism.distortion.geometric.grid_rendering.point_projector

 1# Copyright 2022 vkit-x Administrator. All Rights Reserved.
 2#
 3# This project (vkit-x/vkit) is dual-licensed under commercial and SSPL licenses.
 4#
 5# The commercial license gives you the full rights to create and distribute software
 6# on your own terms without any SSPL license obligations. For more information,
 7# please see the "LICENSE_COMMERCIAL.txt" file.
 8#
 9# This project is also available under Server Side Public License (SSPL).
10# The SSPL licensing is ideal for use cases such as open source projects with
11# SSPL distribution, student/academic purposes, hobby projects, internal research
12# projects without external distribution, or other projects where all SSPL
13# obligations can be met. For more information, please see the "LICENSE_SSPL.txt" file.
14from typing import Union, Iterable
15
16from vkit.element import Point, PointList, PointTuple
17
18
19class PointProjector:
20
21    def project_point(self, src_point: Point) -> Point:
22        raise NotImplementedError()
23
24    def project_points(self, src_points: Union[PointList, PointTuple, Iterable[Point]]):
25        dst_points = PointList()
26        for src_point in src_points:
27            dst_points.append(self.project_point(src_point))
28        return dst_points.to_point_tuple()
class PointProjector:
20class PointProjector:
21
22    def project_point(self, src_point: Point) -> Point:
23        raise NotImplementedError()
24
25    def project_points(self, src_points: Union[PointList, PointTuple, Iterable[Point]]):
26        dst_points = PointList()
27        for src_point in src_points:
28            dst_points.append(self.project_point(src_point))
29        return dst_points.to_point_tuple()
PointProjector()
def project_point(self, src_point: vkit.element.point.Point) -> vkit.element.point.Point:
22    def project_point(self, src_point: Point) -> Point:
23        raise NotImplementedError()
def project_points( self, src_points: Union[vkit.element.point.PointList, vkit.element.point.PointTuple, Iterable[vkit.element.point.Point]]):
25    def project_points(self, src_points: Union[PointList, PointTuple, Iterable[Point]]):
26        dst_points = PointList()
27        for src_point in src_points:
28            dst_points.append(self.project_point(src_point))
29        return dst_points.to_point_tuple()