How to use the @bentley/geometry-core.Transform.createOriginAndMatrix function in @bentley/geometry-core

To help you get started, we’ve selected a few @bentley/geometry-core examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github imodeljs / imodeljs / core / frontend / src / tile / PntsTileIO.ts View on Github external
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;
  }
}
github imodeljs / imodeljs / test-apps / imodel-from-geojson / src / ClassifyRealityModel.ts View on Github external
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 {
github imodeljs / imodeljs / test-apps / imodel-from-reality-model / src / RealityModelContextIModelCreator.ts View on Github external
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]));
  }
}
github imodeljs / imodeljs / core / common / src / geometry / GeometryStream.ts View on Github external
public setLocalToWorld2d(origin: Point2d, angle: Angle = Angle.createDegrees(0.0)) {
    this.setLocalToWorld(Transform.createOriginAndMatrix(Point3d.createFrom(origin), Matrix3d.createRotationAroundVector(Vector3d.unitZ(), angle)!));
  }
github imodeljs / imodeljs / core / common / src / geometry / GeometryStream.ts View on Github external
public setLocalToWorld3d(origin: Point3d, angles: YawPitchRollAngles = YawPitchRollAngles.createDegrees(0.0, 0.0, 0.0)) {
    this.setLocalToWorld(Transform.createOriginAndMatrix(origin, angles.toMatrix3d()));
  }
github imodeljs / imodeljs / core / common / src / geometry / GeometryStream.ts View on Github external
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;
  }
github imodeljs / imodeljs / core / common / src / geometry / Primitives.ts View on Github external
  public get transform(): Transform { return Transform.createOriginAndMatrix(Point3d.createFrom(this.origin), this.rotation); }
  /** Create a new Placement2d from a Placement2dProps. */
github imodeljs / imodeljs / core / common / src / geometry / Placement.ts View on Github external
  public get transform(): Transform { return Transform.createOriginAndMatrix(this.origin, this.rotation); }
github imodeljs / imodeljs / core / common / src / geometry / GeometryStream.ts View on Github external
public setLocalToWorld3d(origin: Point3d, angles: YawPitchRollAngles = YawPitchRollAngles.createDegrees(0.0, 0.0, 0.0)) {
    this.setLocalToWorld(Transform.createOriginAndMatrix(origin, angles.toMatrix3d()));
  }