Point (ポイント)#

Point は、そのx座標とy座標で定義される平面上のポイントを表します。

属性/メソッド

説明

Point.distance_to()

ポイントまたは長方形までの距離を計算します

Point.norm()

ユークリッドノルム

Point.transform()

行列でポイントを変換します

Point.abs_unit

ユニットと同じですが、座標が正です

Point.unit

座標を abs(point) で割ったもの

Point.x

X座標

Point.y

Y座標

クラスAPI

class Point#
__init__(self)#
__init__(self, x, y)#
__init__(self, point)#
__init__(self, sequence)#

オーバーロードされたコンストラクタ。

パラメーターなしで、Point(0, 0) が作成されます。

他のポイントが指定された場合、新しいコピー が作成され、 "sequence"は2つの数値からなるPythonシーケンスです(PythonシーケンスをPyMuPDFで引数として使用する場合)。

パラメータ:
  • x (float) -- ポイントのx座標

  • y (float) -- ポイントのy座標

distance_to(x[, unit])#

x までの距離を計算します。 xpoint_like または rect_like である可能性があります。距離は、ピクセル(デフォルト)、インチ、センチメートル、ミリメートルのいずれかの単位で指定されます。

パラメータ:
  • x (point_like,rect_like) -- 距離を計算する対象

  • unit (str) -- 測定単位。 "px"、 "in"、 "cm"、 "mm"のいずれか

戻り値の型:

float

戻り値:

x までの距離。これが rect_like の場合、距離

  • 長方形の任意の辺に接続する最短線の長さ

  • その 有限バージョン が計算されます

  • ポイントを 含む 場合はゼロ

norm()#
  • バージョン1.16.0で新規追加

ベクトルとしてのポイントのユークリッドノルム(長さ)を返します。 abs() 関数の結果と等しいです。

transform(m)#

ポイントに行列を適用して、その結果で置き換えます。

パラメータ:

m (matrix_like) -- 適用する行列。

戻り値の型:

Point (ポイント)

unit#

各座標を norm(point) 、ポイントが(0、0)からの距離で割った結果です。これは、ポイント自体がx軸との角度を持つベクトルと同じ方向を指す長さ1のベクトルです。そのx、resp。 yの値は、このベクトル(およびポイント自体)がx軸とどのような角度を持っているかに等しいです。

_images/img-point-unit.jpg
Type:

Point (ポイント)

abs_unit#

同じく、上記の unit と同様のもので、座標をそれぞれの絶対値に置き換えたものです。

Type:

Point (ポイント)

x#

x座標

Type:

float

y#

y座標

Type:

float

注釈


This software is provided AS-IS with no warranty, either express or implied. This software is distributed under license and may not be copied, modified or distributed except as expressly authorized under the terms of that license. Refer to licensing information at artifex.com or contact Artifex Software Inc., 39 Mesa Street, Suite 108A, San Francisco CA 94129, United States for further information.

Discord logo