Home > PCB_MathPolygon > calculateHeight
PCB_MathPolygon.calculateHeight() method
This API is provided as a beta preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
Calculate complex polygon BBox height
Signature
typescript
function calculateHeight(
complexPolygon:
| TPCB_PolygonSourceArray
| Array<TPCB_PolygonSourceArray>
| IPCB_Polygon
| IPCB_ComplexPolygon,
): number;1
2
3
4
5
6
7
2
3
4
5
6
7
Parameters
Parameter | Type | Description |
|---|---|---|
complexPolygon | TPCB_PolygonSourceArray | Array<TPCB_PolygonSourceArray> | IPCB_Polygon | IPCB_ComplexPolygon | Complex polygon |
Returns
number
BBox height
Example
javascript
// 1. 矩形源数组(宽 100、高 50),BBox 高度为 50
console.log('rectHeight:', eda.pcb_MathPolygon.calculateHeight(['R', 0, 0, 100, 50, 0, 0]));
// 2. 圆心在原点、半径 50 的圆,BBox 高度为直径 100
console.log('circleHeight:', eda.pcb_MathPolygon.calculateHeight(['CIRCLE', 0, 0, 50]));
// 3. 传复杂多边形对象:矩形 Y 范围 0~50,圆 Y 范围 170~230,整体跨度 230
const complexPolygon = eda.pcb_MathPolygon.createComplexPolygon([
['R', 0, 0, 100, 50, 0, 0],
['CIRCLE', 200, 200, 30],
]);
console.log('complexHeight:', eda.pcb_MathPolygon.calculateHeight(complexPolygon));1
2
3
4
5
6
7
8
9
10
11
12
2
3
4
5
6
7
8
9
10
11
12