public Vector4f transform(Vector4fc v, Vector4f dest) { return v.mul(this, dest); }
public Vector4f transformProject(Vector4fc v, Vector4f dest) { return v.mulProject(this, dest); }
/** * Used to draw rectangle. * * @param nvg nanovg context. * @param position rectangle position. * @param size rectangle size. * @param bgColor rectangle background color. */ public static void drawRect(long nvg, Vector2fc position, Vector2fc size, Vector4fc bgColor) { if (bgColor.w() <= MIN_ALPHA) { return; } try (NVGColor fillColor = NVGColor.calloc()) { NvgColorUtil.fillNvgColorWithRGBA(bgColor, fillColor); nvgBeginPath(nvg); nvgFillColor(nvg, fillColor); nvgRect(nvg, position.x(), position.y(), size.x(), size.y()); nvgFill(nvg); } }
/** * Used to draw rectangle. * * @param nvg nanovg context. * @param position rectangle position. * @param size rectangle size. * @param bgColor rectangle background color. * @param radius cornder radius */ public static void drawRect(long nvg, Vector2fc position, Vector2fc size, Vector4fc bgColor, float radius) { if (bgColor.w() <= MIN_ALPHA) { return; } try (NVGColor fillColor = NVGColor.calloc()) { NvgColorUtil.fillNvgColorWithRGBA(bgColor, fillColor); nvgBeginPath(nvg); nvgFillColor(nvg, fillColor); nvgRoundedRect(nvg, position.x(), position.y(), size.x(), size.y(), radius); nvgFill(nvg); } }
/** * Transform the given vector by the rotation transformation described by this {@link AxisAngle4f} * and store the result in <code>dest</code>. * * @param v * the vector to transform * @param dest * will hold the result * @return dest */ public Vector4f transform(Vector4fc v, Vector4f dest) { double sin = Math.sin(angle); double cos = Math.cosFromSin(sin, angle); float dot = x * v.x() + y * v.y() + z * v.z(); dest.set((float) (v.x() * cos + sin * (y * v.z() - z * v.y()) + (1.0 - cos) * dot * x), (float) (v.y() * cos + sin * (z * v.x() - x * v.z()) + (1.0 - cos) * dot * y), (float) (v.z() * cos + sin * (x * v.y() - y * v.x()) + (1.0 - cos) * dot * z), dest.w); return dest; }
/** * Used to draw rectangle stroke. * * @param nvg nanovg context. * @param position rectangle position. * @param size rectangle size. * @param rectStrokeColor rectangle color. * @param strokeWidth stroke width. */ public static void drawRectStroke(long nvg, Vector2fc position, Vector2fc size, Vector4fc rectStrokeColor, float strokeWidth) { if (rectStrokeColor.w() <= MIN_ALPHA) { return; } try (NVGColor strokeColor = NVGColor.calloc()) { NvgColorUtil.fillNvgColorWithRGBA(rectStrokeColor, strokeColor); nvgBeginPath(nvg); nvgStrokeColor(nvg, strokeColor); nvgStrokeWidth(nvg, strokeWidth); nvgRect(nvg, position.x(), position.y(), size.x(), size.y()); nvgStroke(nvg); } }
public Vector4f transform(Vector4fc v, Vector4f dest) { return v.mul(this, dest); }
public Vector4f transformProject(Vector4fc v, Vector4f dest) { return v.mulProject(this, dest); }
/** * Transform the given vector by the rotation transformation described by this {@link AxisAngle4f} * and store the result in <code>dest</code>. * * @param v * the vector to transform * @param dest * will hold the result * @return dest */ public Vector4f transform(Vector4fc v, Vector4f dest) { double sin = Math.sin(angle); double cos = Math.cosFromSin(sin, angle); float dot = x * v.x() + y * v.y() + z * v.z(); dest.set((float) (v.x() * cos + sin * (y * v.z() - z * v.y()) + (1.0 - cos) * dot * x), (float) (v.y() * cos + sin * (z * v.x() - x * v.z()) + (1.0 - cos) * dot * y), (float) (v.z() * cos + sin * (x * v.y() - y * v.x()) + (1.0 - cos) * dot * z), dest.w); return dest; }
/** * Used to draw rectangle stroke. * * @param nvg nanovg context. * @param position rectangle position. * @param size rectangle size. * @param rectStrokeColor rectangle color. * @param radius corner radius * @param strokeWidth stroke width. */ public static void drawRectStroke(long nvg, Vector2fc position, Vector2fc size, Vector4fc rectStrokeColor, float strokeWidth, float radius) { if (rectStrokeColor.w() <= MIN_ALPHA) { return; } try (NVGColor strokeColor = NVGColor.calloc()) { NvgColorUtil.fillNvgColorWithRGBA(rectStrokeColor, strokeColor); nvgBeginPath(nvg); nvgStrokeColor(nvg, strokeColor); nvgStrokeWidth(nvg, strokeWidth); nvgRoundedRect(nvg, position.x(), position.y(), size.x(), size.y(), radius); nvgStroke(nvg); } }
public Vector4f transform(Vector4fc v, Vector4f dest) { return v.mul(this, dest); }
public Vector4f transform(Vector4fc v, Vector4f dest) { return v.mul(this, dest); }
public Vector4f smoothStep(Vector4fc v, float t, Vector4f dest) { float t2 = t * t; float t3 = t2 * t; dest.x = (x + x - v.x() - v.x()) * t3 + (3.0f * v.x() - 3.0f * x) * t2 + x * t + x; dest.y = (y + y - v.y() - v.y()) * t3 + (3.0f * v.y() - 3.0f * y) * t2 + y * t + y; dest.z = (z + z - v.z() - v.z()) * t3 + (3.0f * v.z() - 3.0f * z) * t2 + z * t + z; dest.w = (w + w - v.w() - v.w()) * t3 + (3.0f * v.w() - 3.0f * w) * t2 + w * t + w; return dest; }