summaryrefslogtreecommitdiff
path: root/include/glass_data.h
blob: 75aedde3c16d018a5932a8d138dcb65d53ada479 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
/**
 * glass_data.h - header file from glass_data.c.
 *
 * Copyright (C) 2025 https://optics-design.com
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License as
 * published by the Free Software Foundation, either version 3 of the
 * License, or (at your option) any later version.
 *
 * See the COPYING file for the full license text.
 */
#ifndef GLASS_DATA_H
#define GLASS_DATA_H

#include "glamacdef.h"  // For type definitions
#include "glamac_errors.h"  // For error handling

// Structure to represent an optical glass
typedef struct {
    byte name[50];
    f32 abbeNumber;  // X-axis (vd)
    f32 refractiveIndex;  // Y-axis (nd)
    byte glass_code[20];  // Glass code from manufacturer
    byte manufacturer[20];  // Manufacturer name
} Glass;

// Get number of glasses in the catalog
u32 get_glass_count(void);

// Get glass at index
const Glass* get_glass(u32 index);

// Get glass name
const byte* get_glass_name(u32 index);

// Find data range in glass catalog
void find_glass_data_range(f32 *minAbbe, f32 *maxAbbe, f32 *minRI, f32 *maxRI);

// Initialize glass data - call at program start
void initialize_glass_data(void);

// Load glasses from JSON file
b32 load_glasses_from_json(const byte* json_path, const byte* manufacturer_filter);

// Cleanup glass data resources
void cleanup_glass_data(void);

#endif /* GLASS_DATA_H */
Back to https://optics-design.com