npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

glsl-domain-coloring

v2.0.6

Published

A glslify module for domain coloring in the complex plane

Downloads

12

Readme

glsl-domain-coloring

Domain coloring as a shader, via glslify.

glsl-domain-coloring

Introduction

Domain coloring is an improvement over simple coloring by the complex argument and lightness by the magnitude. It makes the function easier to understand by applying the following logic:

  • the complex argument determines the hue. (Red is positive real and cyan is negative real, while green-yellow is positive imaginary and blue-magenta is negative imaginary.)
  • contours of the complex magnitude are lightened. The contours occur near integer values of log2(|z|).
  • real and imaginary grid lines are darkened. With grid spacing (1, 1), this means that the dark lines are simply the unit grid.

The result of these choices is that the behavior of the function is easier to discern than by a simple colormap. For example, the function f(z) = z plotted from -2 to 2 on the real and imaginary axes results in the colormap:

The function f(z) = 1 / z in the same range results in the map:

In the second example, the pole of the function is indicated by the bunching up of the grid lines as the white magnitude contours get closer and closer to the pole. In the first example though, the bunching up of the white magnitude contours without bunching up of the black grid lines indicates that it's a zero rather than a pole.

Examples

Live demos:

To use with glslify:

#pragma glslify: domainColoring = require(glsl-domain-coloring)

attribute vec3 position;

varying vec2 z;

void main () {
  gl_FragColor = domainColoring(z, vec2(1.0), 0.9, 0.5, 0.7);
}

API

vec3 domainColoring(vec2 f, vec2 gridSpacing, float saturation, float gridStrength, float magStrength)

Returns the rgb value given the real and imaginary components of f.

Arguments:

  • f: A vec2 containing the real and imaginary components of the function
  • gridSpacing: a vec2 containing the spacing of the grid in the x and y directions
  • saturation: the saturation of the coloring, from zero to one
  • gridStrength: the strength of the rectangular grid, from zero to one
  • magStrength: the strength of the magnitude contours, from zero to one
  • linePower: the strength of the lines, as a positive floating point number. Larger numbers result in sharper contours.

License

© 2016 Ricky Reusser. MIT License.