CGVIS Utils
Loading...
Searching...
No Matches
Grid2D.h File Reference

2D scalar grid (float) with sampling, arithmetic, SDF, and I/O helpers. More...

#include <iostream>
#include <string>
#include <vector>
#include "Vec2.h"
#include "Vec3.h"
#include "Image.h"
#include "GLTexture2D.h"
Include dependency graph for Grid2D.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  Grid2D

Detailed Description

2D scalar grid (float) with sampling, arithmetic, SDF, and I/O helpers.

Represents a width×height grid of single‑precision values stored in row‑major order. Provides bilinear sampling in normalized coordinates, gradient‑based normal estimation, per‑element arithmetic (with scalars and other grids, with automatic size reconciliation), conversion to images / textures, and simple binary streaming.

Unless stated otherwise, functions interpret normalized positions (x,y) with 0 at the left/bottom and 1 at the right/top, and clamp to [0,1]. When combining two grids of different sizes, operations resample the smaller grid to the larger grid's resolution using bilinear sampling.