How to use the @here/harp-utils.MathUtils.lerp function in @here/harp-utils

To help you get started, we’ve selected a few @here/harp-utils 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 heremaps / harp.gl / @here / harp-mapview / lib / MapViewFog.ts View on Github external
const target = MapViewUtils.rayCastWorldCoordinates(mapView, 0, 0);
            if (target === null) {
                throw new Error("MapView does not support a view pointing in the void.");
            }
            const t = Math.abs(
                Math.cos(
                    MapViewUtils.extractSphericalCoordinatesFromLocation(
                        mapView,
                        mapView.camera,
                        mapView.projection.unprojectPoint(target)
                    ).tilt
                )
            );
            const density = MathUtils.smoothStep(horizontalDensity, verticalDensity, t);
            this.m_fog.near = MathUtils.lerp(viewRange * startRatio, viewRange, 1.0 - density);
            this.m_fog.far = MathUtils.lerp(viewRange * endRatio, viewRange, density);
            this.m_fog.near = Math.min(this.m_fog.near, mapView.camera.far);
            this.m_fog.far = Math.min(this.m_fog.far, mapView.camera.far);
        }
    }
github heremaps / harp.gl / @here / harp-mapview / lib / MapViewFog.ts View on Github external
assert(startRatio <= endRatio);
            const target = MapViewUtils.rayCastWorldCoordinates(mapView, 0, 0);
            if (target === null) {
                throw new Error("MapView does not support a view pointing in the void.");
            }
            const t = Math.abs(
                Math.cos(
                    MapViewUtils.extractSphericalCoordinatesFromLocation(
                        mapView,
                        mapView.camera,
                        mapView.projection.unprojectPoint(target)
                    ).tilt
                )
            );
            const density = MathUtils.smoothStep(horizontalDensity, verticalDensity, t);
            this.m_fog.near = MathUtils.lerp(viewRange * startRatio, viewRange, 1.0 - density);
            this.m_fog.far = MathUtils.lerp(viewRange * endRatio, viewRange, density);
            this.m_fog.near = Math.min(this.m_fog.near, mapView.camera.far);
            this.m_fog.far = Math.min(this.m_fog.far, mapView.camera.far);
        }
    }