How to use the @bentley/geometry-core.Point3d.create 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 / test-apps / analysis-importer / src / AnalysisImporter.ts View on Github external
private createFlatMeshWithWaves() {
    const options = StrokeOptions.createForFacets();
    options.shouldTriangulate = true;
    const builder = PolyfaceBuilder.create(options);
    const nDimensions = 100;
    const spacing = 1.0;

    /** Create a simple flat mesh with 10,000 points (100x100) */
    for (let iRow = 0; iRow < nDimensions - 1; iRow++) {
      for (let iColumn = 0; iColumn < nDimensions - 1; iColumn++) {
        const quad = [Point3d.create(iRow * spacing, iColumn * spacing, 0.0),
          Point3d.create((iRow + 1) * spacing, iColumn * spacing, 0.0),
          Point3d.create((iRow + 1) * spacing, (iColumn + 1) * spacing, 0.0),
          Point3d.create(iRow * spacing, (iColumn + 1) * spacing)];
        builder.addQuadFacet(quad);
      }
    }

    const polyface = builder.claimPolyface();
    const zeroScalarData = [], zeroDisplacementData = [], radialHeightData = [], radialSlopeData = [], radialDisplacementData = [];
    const radius = nDimensions * spacing / 2.0;
    const center = new Point3d(radius, radius, 0.0);
    const maxHeight = radius / 4.0;
    const auxChannels = [];

    /** Create a radial wave - start and return to zero  */
    for (let i = 0; i < polyface.data.point.length; i++) {
      const angle = Angle.pi2Radians * polyface.data.point.distanceIndexToPoint(i, center)! / radius;
      const height = maxHeight * Math.sin(angle);
      const slope = Math.abs(Math.cos(angle));
github imodeljs / imodeljs / core / frontend / src / tile / IModelTileIO.ts View on Github external
const json = primitive.vertices;
      if (undefined === json)
        return undefined;

      const bytes = this.findBuffer(JsonUtils.asString(json.bufferView));
      if (undefined === bytes)
        return undefined;

      const uniformFeatureID = undefined !== json.featureID ? JsonUtils.asInt(json.featureID) : undefined;

      const rangeMin = JsonUtils.asArray(json.params.decodedMin);
      const rangeMax = JsonUtils.asArray(json.params.decodedMax);
      if (undefined === rangeMin || undefined === rangeMax)
        return undefined;

      const qparams = QParams3d.fromRange(Range3d.create(Point3d.create(rangeMin[0], rangeMin[1], rangeMin[2]), Point3d.create(rangeMax[0], rangeMax[1], rangeMax[2])));

      const uniformColor = undefined !== json.uniformColor ? ColorDef.fromJSON(json.uniformColor) : undefined;
      let uvParams: QParams2d | undefined;
      if (undefined !== primitive.surface && undefined !== primitive.surface.uvParams) {
        const uvMin = JsonUtils.asArray(primitive.surface.uvParams.decodedMin);
        const uvMax = JsonUtils.asArray(primitive.surface.uvParams.decodedMax);
        if (undefined === uvMin || undefined === uvMax)
          return undefined;

        const uvRange = new Range2d(uvMin[0], uvMin[1], uvMax[0], uvMax[1]);
        uvParams = QParams2d.fromRange(uvRange);
      }

      return new VertexTable({
        data: bytes,
        qparams,
github imodeljs / imodeljs / core / common / src / QPoint.ts View on Github external
  public static fromNormalizedRange() { return QParams3d.fromRange(Range3d.createArray([Point3d.create(-1, -1, -1), Point3d.create(1, 1, 1)])); }
github imodeljs / imodeljs / core / frontend / src / render / webgl / SolarShadowMap.ts View on Github external
this._shadowFrustum.initFromRange(shadowRange);
        mapToWorld.multiplyPoint3dArrayQuietNormalize(this._shadowFrustum.points);
      }

      const frustumMap = this._shadowFrustum.toMap4d();
      if (undefined === frustumMap) {
        this.clearGraphics(true);
        assert(false);
        return;
      }

      this._projectionMatrix = frustumMap.transform0.clone();

      const worldToNpc = postProjectionMatrixNpc.multiplyMatrixMatrix(this._projectionMatrix);
      const npcToView = Map4d.createBoxMap(Point3d.create(0, 0, 0), Point3d.create(1, 1, 1), Point3d.create(0, 0, 0), Point3d.create(shadowMapWidth, shadowMapHeight, 1))!;
      const npcToWorld = worldToNpc.createInverse();
      if (undefined === npcToWorld) {
        this.clearGraphics(true);
        return;
      }

      const worldToNpcMap = Map4d.createRefs(worldToNpc, npcToWorld);
      this._worldToViewMap = npcToView.multiplyMapMap(worldToNpcMap);
    }

    this.notifyGraphicsChanged();
  }
github imodeljs / imodeljs / core / frontend / src / AccuSnap.ts View on Github external
  protected isSelected(pt: XAndY): boolean { return this.position.distance(Point3d.create(pt.x, pt.y)) < this._size; }
  public isButtonHandled(ev: BeButtonEvent): boolean { return (BeButton.Data === ev.button && InputSource.Touch === ev.inputSource && !this._inTouchTap); }
github imodeljs / imodeljs / core / common / src / QPoint.ts View on Github external
  public static fromZeroToOne() { return QParams3d.fromRange(Range3d.createArray([Point3d.create(0, 0, 0), Point3d.create(1, 1, 1)])); }
}
github imodeljs / imodeljs / core / frontend / src / render / webgl / System.ts View on Github external
edge.collectAroundFace((node: HalfEdge) => {
              const point = Point3d.create(node.x, node.y, 0.5);
              trianglePoints.push(point);
              const paramUnscaled = point.minus(sheetTileOrigin);
              params.push(Point2d.create(paramUnscaled.x * sheetTileScale, paramUnscaled.y * sheetTileScale));
            });