Constructor
A 3D vector that describes a point in space and an intensity value.
Parameters:
Name | Type | Description |
---|---|---|
args |
object |
An object used to initialize the Point. If |
- Default Value:
-
- { x: 0, y: 0, intensity: 0.5 }
Example
const point = new PSPDFKit.Geometry.DrawingPoint({
x: 20,
y: 30,
intensity: 0.3
});
point.intensity; // => 0.3
Extends
Members
Methods
Members
The intensity
is used to describe the pressure of a point inside
an ink annotation. It is capped between 0 and 1 inclusive.
If the touch input does not allow to measure the pressure, a value of
0.5
should be used.
Type:
- number
- Default Value:
-
- 0.5
The x
coordinate of the point.
Type:
- number
- Inherited From:
- Default Value:
-
- 0
The y
coordinate of the point.
Type:
- number
- Inherited From:
- Default Value:
-
- 0
Methods
Calculates the euclidean distance to another point.
Parameters:
Name | Type | Description |
---|---|---|
other |
PSPDFKit.Geometry.Point |
The other point to calculate the distance with. |
- Inherited From:
Returns:
The distance between the two points.
- Type
- number
Example
var point1 = new PSPDFKit.Geometry.Point({ x: 10, y: 10 });
var point2 = new PSPDFKit.Geometry.Point({ x: 20, y: 10 });
point1.distance(point2); // => 10
Scales x
and y
by the given sx
and
sy
factor. If only sx
is set and sy
not
defined, it will scale x
and y
by sx
.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
sx |
number |
Scale value for the |
|
sy |
number | <nullable> |
If empty, it will scale |
- Inherited From:
Returns:
A new Point
.
Example
const point = new PSPDFKit.Geometry.Point({ x: 10, y: 10 });
point.scale(2); // => Point {x: 20, y: 20}
Translate all values of the point by a given Point
.
Parameters:
Name | Type | Description |
---|---|---|
point |
PSPDFKit.Geometry.Point |
A point that describes the translation distance. |
- Inherited From:
Returns:
A new Point
.
Example
const point = new PSPDFKit.Geometry.Point({ x: 10, y: 10 });
point.translate(new PSPDFKit.Geometry.Point({ x: 5, y: -5 })); // => Point {x: 15, y: 5}
Translate the x
value by a given number.
Parameters:
Name | Type | Description |
---|---|---|
tx |
number |
A number to translate the |
- Inherited From:
Returns:
A new Point
.
Example
const point = new PSPDFKit.Geometry.Point({ x: 10, y: 10 });
point.translateX(5); // => Point {x: 15, y: 10}
Translate the y
value by a given number.
Parameters:
Name | Type | Description |
---|---|---|
ty |
number |
A number to translate the |
- Inherited From:
Returns:
A new Point
.
Example
const point = new PSPDFKit.Geometry.Point({ x: 10, y: 10 });
point.translateY(5); // => Point {x: 10, y: 15}