Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
colors = new Uint8Array(3 * featureValue.POINTS_LENGTH);
colors.fill(0xff, 0, colors.length); // TBD... Default color?
}
// ###TODO? Do we expect a batch table? not currently handled...
const featureTable = new FeatureTable(1, modelId, BatchType.Primary);
const features = new Mesh.Features(featureTable);
features.add(new Feature(modelId), 1);
let renderGraphic = system.createPointCloud(new PointCloudArgs(qPoints, qParams, colors, features), iModel);
renderGraphic = system.createBatch(renderGraphic!, PackedFeatureTable.pack(featureTable), range);
if (yAxisUp) {
const branch = new GraphicBranch();
branch.add(renderGraphic!);
const transform = Transform.createOriginAndMatrix(undefined, Matrix3d.createRotationAroundVector(Vector3d.create(1.0, 0.0, 0.0), Angle.createRadians(Angle.piOver2Radians)) as Matrix3d);
renderGraphic = system.createBranch(branch, transform);
}
return renderGraphic;
}
}
public static transformFromJson(jTrans: number[] | undefined): Transform | undefined {
return (jTrans === undefined) ? undefined : Transform.createOriginAndMatrix(Point3d.create(jTrans[12], jTrans[13], jTrans[14]), Matrix3d.createRowValues(jTrans[0], jTrans[4], jTrans[8], jTrans[1], jTrans[5], jTrans[9], jTrans[2], jTrans[6], jTrans[10]));
}
public static rangeFromJson(json: any): AxisAlignedBox3d {
public static transformFromJson(jTrans: number[] | undefined): Transform | undefined {
return (jTrans === undefined) ? undefined : Transform.createOriginAndMatrix(Point3d.create(jTrans[12], jTrans[13], jTrans[14]), Matrix3d.createRowValues(jTrans[0], jTrans[4], jTrans[8], jTrans[1], jTrans[5], jTrans[9], jTrans[2], jTrans[6], jTrans[10]));
}
}
public setLocalToWorld2d(origin: Point2d, angle: Angle = Angle.createDegrees(0.0)) {
this.setLocalToWorld(Transform.createOriginAndMatrix(Point3d.createFrom(origin), Matrix3d.createRotationAroundVector(Vector3d.unitZ(), angle)!));
}
public setLocalToWorld3d(origin: Point3d, angles: YawPitchRollAngles = YawPitchRollAngles.createDegrees(0.0, 0.0, 0.0)) {
this.setLocalToWorld(Transform.createOriginAndMatrix(origin, angles.toMatrix3d()));
}
public appendGeometryPart3d(partId: Id64String, instanceOrigin?: Point3d, instanceRotation?: YawPitchRollAngles, instanceScale?: number): boolean {
if (undefined === this._worldToLocal) {
this.geometryStream.push({ geomPart: { part: partId, origin: instanceOrigin, rotation: instanceRotation, scale: instanceScale } });
return true;
}
const partTrans = Transform.createOriginAndMatrix(instanceOrigin, instanceRotation ? instanceRotation.toMatrix3d() : Matrix3d.createIdentity());
if (undefined !== instanceScale)
partTrans.matrix.scaleColumnsInPlace(instanceScale, instanceScale, instanceScale);
const resultTrans = partTrans.multiplyTransformTransform(this._worldToLocal);
const scales = new Vector3d();
if (!resultTrans.matrix.normalizeColumnsInPlace(scales))
return false;
const newRotation = YawPitchRollAngles.createFromMatrix3d(resultTrans.matrix);
if (undefined === newRotation)
return false;
this.geometryStream.push({ geomPart: { part: partId, origin: resultTrans.getOrigin(), rotation: newRotation, scale: scales.x } });
return true;
}
public get transform(): Transform { return Transform.createOriginAndMatrix(Point3d.createFrom(this.origin), this.rotation); }
/** Create a new Placement2d from a Placement2dProps. */
public get transform(): Transform { return Transform.createOriginAndMatrix(this.origin, this.rotation); }
public setLocalToWorld3d(origin: Point3d, angles: YawPitchRollAngles = YawPitchRollAngles.createDegrees(0.0, 0.0, 0.0)) {
this.setLocalToWorld(Transform.createOriginAndMatrix(origin, angles.toMatrix3d()));
}