Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
public static createTestRegionData() {
const origin = {
x: randomIntInRange(0, 1024),
y: randomIntInRange(0, 768),
};
const size = {
width: randomIntInRange(1, 100),
height: randomIntInRange(1, 100),
};
return new RegionData(origin.x, origin.y, size.width, size.height,
[
new Point2D(origin.x, origin.y), // Top left
new Point2D(origin.x + size.width, origin.y), // Top Right
new Point2D(origin.x, origin.y + size.height), // Bottom Left
new Point2D(origin.x + size.width, origin.y + size.height), // Bottom Right
],
RegionDataType.Rect);
}
/**
public static getRegionData(region: IRegion): RegionData {
return new RegionData(region.boundingBox.left,
region.boundingBox.top,
region.boundingBox.width,
region.boundingBox.height,
region.points.map((point) =>
new Point2D(point.x, point.y)),
this.regionTypeToType(region.type));
}