4 #include <nlohmann/json.hpp>
12 constexpr
static auto name() -> std::string_view {
return "triangle_fan"; }
28 NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_FROM,
name,
radius,
center));
29 assert(nlohmann_json_j.contains(
"degrees"));
30 if (
const auto& deg = nlohmann_json_j[
"degrees"]; deg.is_number()) {
31 nlohmann_json_t.
degrees = std::array<double, 2>{{0.0, double(deg)}};
33 nlohmann_json_t.
degrees = deg.get<std::array<double, 2>>();
49 nlohmann_json_j[
"size"] = nlohmann_json_t.
size;
51 nlohmann_json_j[
"coordinates"] = *nlohmann_json_t.
coordinates;
58 nlohmann_json_t.
size = nlohmann_json_j[
"size"];
59 if (
const auto& coords = nlohmann_json_j[
"coordinates"]; !coords.is_null()) {
constexpr static auto name() -> std::string_view
friend void from_json(const nlohmann::json &nlohmann_json_j, TriangleFanOptions &nlohmann_json_t)
std::optional< Coordinates > coordinates
friend void to_json(nlohmann::json &nlohmann_json_j, const TriangleFanOptions &nlohmann_json_t)
std::optional< std::string > get_coordinate_name() const
friend void to_json(nlohmann::json &nlohmann_json_j, const Coordinates &nlohmann_json_t)
std::array< double, 2 > center
std::array< double, 2 > degrees
friend void from_json(const nlohmann::json &nlohmann_json_j, Coordinates &nlohmann_json_t)