# Which data structure should I use for hierarchical T-meshes and PHT-splines?

Recently, I'm working on something about polynomial splines over hierarchical T-meshes, which is basically a rectangular grid that allows T-junctions. I want to do some numerical experiments but I don't know how to represent T-meshes and splines over it in a computer. I'm going to study about PHT-splines and Hermite splines over T-meshes.

So my problem is: Which data structure should I use for them? Thank you~

I've tried to search for it on google. But all I found are about mathematical analysis of them and none is about the data structure.

Note: For details of T-meshes and PHT splines you can refer to this article
[pdf] Polynomial splines over hierarchical T-meshes

-
To my (untrained) eye, this looks more like a question for programmers, in which case it may fare better on StackOverflow. – Loop Space Aug 8 '11 at 11:37
Looks like that to my trained eye also. – Igor Rivin Aug 8 '11 at 12:57
@Andrew @Igor: Uh.. Well, it does be a program problem. But I think mathematicians in this area may be more familiar with T-meshes and PHT-splines. These mathematical conceptions is not so easy to be explained in a few words, if I asked it on StackOverflow... And I believe mathematicians who have worked with such splines will know the answer. – Roun Aug 8 '11 at 13:19
The problem is that typical programmers would have even less of a clue about this topic than mathematicians. – Victor Liu Aug 9 '11 at 2:59
I also need any code in c++ or matlab to implement how to generate this PHT spline in hierarchical t-meshes. If anyone can help me then it will be really great for me. Thanks... – user2855326 Nov 18 '13 at 13:24

PHT-Splines are hierarchical, and therefore recursive in nature. I use a kd-tree structure for my surfaces. This facilitates a fast lookup when querying on (x,y) or (u,v).

There are a number of ways you can manage the storage. I actually store the full set of Bezier control points for my bicubic patches in each leaf. It's not the most space efficient, but it is fairly convenient for evaluation.

-

There is literature on how to represent T-meshes. For example, the paper below acknowledges that the flexibility of T-meshes make them difficult to represent in a data structure. So they

"recommend using the extended T-mesh instead of the original one. We will show that, the extended T-mesh can be represented by a obj-like format ﬁle, and converted into a simple face-edge-vertex data structure easily."

"Extended T-mesh and Data Structure for the Easy Computation of T-spline." Hongwei Lin, Ye Cai, Shuming Gao. Journal of Information & Computational Science 9: 3 (2012) 583–593. (Journal link)

-
Thanks for your reply. I want to implement polynomial spline over hierarchical t-meshes for isogeometric analysis and for this reason I need any sample code or data structure or algorithm for implementing polynomial spline over hierarchical t-meshes. If you can help me then please kindly let me know. Thanks for your suggestion. – user42942 Nov 18 '13 at 14:55