Files
ViewDesignEngine/include/vde/sdf/sdf_torch.h
T

36 lines
1.2 KiB
C++
Raw Normal View History

#pragma once
#include "vde/sdf/sdf_gradient.h"
#include "vde/sdf/sdf_tree.h"
#include "vde/core/point.h"
#include <vector>
// This header is optional — only compiled if Torch is available
namespace vde::sdf {
/// Evaluate SDF on a batch of points (for batched computation)
/// @param root SDF tree
/// @param points Flat array of x,y,z triplets (size = 3*n)
/// @param n Number of points
/// @param distances Output array (size = n)
void evaluate_batch(const SdfNodePtr& root,
const double* points, int n,
double* distances);
/// Compute gradients for a batch of points
/// @param root SDF tree
/// @param points Flat array of x,y,z triplets
/// @param n Number of points
/// @param gradients Output array (size = 3*n, interleaved x,y,z)
void gradient_batch(const SdfNodePtr& root,
const double* points, int n,
double* gradients);
/// Compute both values and gradients in one pass
void evaluate_with_gradient_batch(const SdfNodePtr& root,
const double* points, int n,
double* distances,
double* gradients);
} // namespace vde::sdf