private float getWeightedHeight(final float viewX, final float viewY, final float h, final float w, final float scaledClipSideSize) { final float maxDistance = Math.max(viewX, viewY) / scaledClipSideSize; final float blend = MathUtils.clamp((maxDistance - 0.51f) * 2.2f, 0.0f, 1.0f); return MathUtils.lerp(blend, h, w); }
public void setCurrentValue(final int currentValue, final UISlider slider) { if (_currentValue == currentValue) { return; } _currentValue = MathUtils.clamp(currentValue, _minValue, _maxValue); if (slider != null) { slider.fireChangeEvent(); } }
private float getWeightedHeight(final float viewX, final float viewY, final float h, final float w, final float scaledClipSideSize) { final float maxDistance = Math.max(viewX, viewY) / scaledClipSideSize; final float blend = MathUtils.clamp((maxDistance - 0.51f) * 2.2f, 0.0f, 1.0f); return MathUtils.lerp(blend, h, w); }
public void setCurrentValue(final int currentValue, final UISlider slider) { if (_currentValue == currentValue) { return; } _currentValue = MathUtils.clamp(currentValue, _minValue, _maxValue); if (slider != null) { slider.fireChangeEvent(); } }
public void setValue(final double value) { _value = MathUtils.clamp(value, _minValue, _maxValue); setText(Double.toString(_value)); }
public double eval(final double x, final double y, final double z) { return MathUtils.clamp(source.eval(x, y, z), min, max); } };
public double eval(final double x, final double y, final double z) { return MathUtils.clamp(source.eval(x, y, z), min, max); } };
@Override public void lostFocus() { // force a clamp to [min, max] range final String text = getText(); _value = text.trim() == "" ? 0.0 : MathUtils.clamp(Double.parseDouble(text), _minValue, _maxValue); super.lostFocus(); } }
@Override public void lostFocus() { // force a clamp to [min, max] range final String text = getText(); _value = text == "" ? 0 : MathUtils.clamp(Integer.parseInt(text), _minValue, _maxValue); super.lostFocus(); } }
private int findClipIndex(final ReadOnlyVector3 pointInEyeSpace) { final Vector2 gridPoint = _tracers.get(_minLevel).get2DPoint(pointInEyeSpace, null); final int maxDist = Math.max(Math.abs((int) gridPoint.getX()), Math.abs((int) gridPoint.getY())) / (_clipmapLevels.get(_minLevel).getClipSideSize() + 1 >> 1); int index = (int) MathUtils.floor(Math.log(maxDist) / Math.log(2)) + 1; index = MathUtils.clamp(index, _minLevel, _maxLevel); return index; }
private int findClipIndex(final ReadOnlyVector3 pointInEyeSpace) { final Vector2 gridPoint = _tracers.get(_minLevel).get2DPoint(pointInEyeSpace, null); final int maxDist = Math.max(Math.abs((int) gridPoint.getX()), Math.abs((int) gridPoint.getY())) / (_clipmapLevels.get(_minLevel).getClipSideSize() + 1 >> 1); int index = (int) MathUtils.floor(Math.log(maxDist) / Math.log(2)) + 1; index = MathUtils.clamp(index, _minLevel, _maxLevel); return index; }
/** * Zoom camera in/out from the target point. * * @param percent * a value applied to the baseDistance to determine how far in/out to zoom. Inverted if * {@link #isInvertedWheel()} is true. */ public void zoom(final double percent) { final double amount = (_invertedWheel ? -1 : 1) * percent * _baseDistance; _sphereCoords.setX(MathUtils.clamp(_sphereCoords.getX() + amount, _minZoomDistance, _maxZoomDistance)); makeDirty(); }
/** * Zoom camera in/out from the target point. * * @param percent * a value applied to the baseDistance to determine how far in/out to zoom. Inverted if * {@link #isInvertedWheel()} is true. */ public void zoom(final double percent) { final double amount = (_invertedWheel ? -1 : 1) * percent * _baseDistance; _sphereCoords.setX(MathUtils.clamp(_sphereCoords.getX() + amount, _minZoomDistance, _maxZoomDistance)); makeDirty(); }
/** * Sets the width of the content area of this component to that given, as long as we're between min and max content * width. * * @param width * the new width */ public void setContentWidth(final int width) { _contentsSize .setWidth(MathUtils.clamp(width, _minimumContentsSize.getWidth(), _maximumContentsSize.getWidth())); }
/** * Sets the height of the content area of this component to that given, as long as we're between min and max content * height. * * @param height * the new height */ public void setContentHeight(final int height) { _contentsSize.setHeight(MathUtils.clamp(height, _minimumContentsSize.getHeight(), _maximumContentsSize.getHeight())); }
/** * Sets the height of the content area of this component to that given, as long as we're between min and max content * height. * * @param height * the new height */ public void setContentHeight(final int height) { _contentsSize.setHeight(MathUtils.clamp(height, getMinimumContentHeight(), getMaximumContentHeight())); }
/** * Sets the width of the content area of this component to that given, as long as we're between min and max content * width. * * @param width * the new width */ public void setContentWidth(final int width) { _contentsSize.setWidth(MathUtils.clamp(width, getMinimumContentWidth(), getMaximumContentWidth())); }
/** * Ensures content size is between min and max. */ protected void validateContentSize() { final int width = MathUtils.clamp(_contentsSize.getWidth(), _minimumContentsSize.getWidth(), _maximumContentsSize.getWidth()); final int height = MathUtils.clamp(_contentsSize.getHeight(), _minimumContentsSize.getHeight(), _maximumContentsSize.getHeight()); _contentsSize.set(width, height); }
/** * Ensures content size is between min and max. */ protected void validateContentSize() { final int width = MathUtils.clamp(_contentsSize.getWidth(), getMinimumContentWidth(), getMaximumContentWidth()); final int height = MathUtils.clamp(_contentsSize.getHeight(), getMinimumContentHeight(), getMaximumContentHeight()); _contentsSize.set(width, height); }
@Override public void applyFilter(final InteractManager manager) { final SpatialState state = manager.getSpatialState(); final ReadOnlyVector3 scale = state.getTransform().getScale(); final double x = MathUtils.clamp(scale.getX(), _minScale.getX(), _maxScale.getX()); final double y = MathUtils.clamp(scale.getY(), _minScale.getY(), _maxScale.getY()); final double z = MathUtils.clamp(scale.getZ(), _minScale.getZ(), _maxScale.getZ()); state.getTransform().setScale(x, y, z); }