souging/TRELLIS_TextTo3D
0
1/*2 * Serialize a voxel grid3 *4 * Copyright (C) 2024, Jianfeng XIANG <belljig@outlook.com>5 * All rights reserved.6 *7 * Licensed under The MIT License [see LICENSE for details]8 *9 * Written by Jianfeng XIANG10 */11 12#pragma once13#include <torch/extension.h>14 15 16#define BLOCK_SIZE 25617 18 19/**20 * Z-order encode 3D points21 *22 * @param x [N] tensor containing the x coordinates23 * @param y [N] tensor containing the y coordinates24 * @param z [N] tensor containing the z coordinates25 *26 * @return [N] tensor containing the z-order encoded values27 */28torch::Tensor29z_order_encode(30 const torch::Tensor& x,31 const torch::Tensor& y,32 const torch::Tensor& z33);34 35 36/**37 * Z-order decode 3D points38 *39 * @param codes [N] tensor containing the z-order encoded values40 *41 * @return 3 tensors [N] containing the x, y, z coordinates42 */43std::tuple<torch::Tensor, torch::Tensor, torch::Tensor>44z_order_decode(45 const torch::Tensor& codes46);47 48 49/**50 * Hilbert encode 3D points51 *52 * @param x [N] tensor containing the x coordinates53 * @param y [N] tensor containing the y coordinates54 * @param z [N] tensor containing the z coordinates55 *56 * @return [N] tensor containing the Hilbert encoded values57 */58torch::Tensor59hilbert_encode(60 const torch::Tensor& x,61 const torch::Tensor& y,62 const torch::Tensor& z63);64 65 66/**67 * Hilbert decode 3D points68 *69 * @param codes [N] tensor containing the Hilbert encoded values70 *71 * @return 3 tensors [N] containing the x, y, z coordinates72 */73std::tuple<torch::Tensor, torch::Tensor, torch::Tensor>74hilbert_decode(75 const torch::Tensor& codes76);77 