Quantcast
Channel: MATLAB Central Newsreader - Flattening 3d surfaces
Viewing all articles
Browse latest Browse all 5

Flattening 3d surfaces

$
0
0
Dear community,

is there any tool to unwind (simply) warped (triangulated) 3d surfaces, e.g. the surface shell of a cylinder (height h, radius r), which should then result in a rectangle of height h and width 2*pi*r.

I know that the resulting surface will be nonoverlapping only in some cases, especially not in the case of bidirectional warped surfaces.

My ideas towards such an algorithm are the following:

1. Start from some triangle of the triangulated surface.
2. go through all edges and "flatten" the adjacent triangles by rotating the non-common cornerpoint around the sharted edge.
3. mark initial triangle as "processed" and the three adjacent triangles as "to be processed"
4. handle all not yet processed triangles in the similar way as in points 2 and 3

using this as a draft for an algorithm, one would have to solve some severe inconstency as one vertex belongs to several triangles and therefore can be "rotated into the target plane" about several edges. This will result in several different projection/rotation points for this vertex. This multiplicity of results could be "solved" by using a mean value, but as this will happen during the algorithm sketched above, the handling of this vertex will also affect later rotation-results.

So, is there any idea instead of this "algorithm" or any hint on how to solve this task?

Best regards,
Johannes Korsawe

Example surface:
p=[ 619.9860 704.4850 736.7430 624.2150 694.1570 766.4950
  617.3630 707.0070 726.5200 624.6740 694.6470 765.9550
  615.6020 708.6260 719.6890 624.9150 694.9840 765.5130
  613.8320 710.1970 712.8460 625.1560 695.4750 764.7450
  624.3820 698.4300 757.0770 625.2820 695.9490 763.8770
  621.8150 701.1420 746.9160 625.3160 696.4290 762.8780
  619.2210 703.7360 736.7240 625.2680 696.8720 761.8460
  616.6020 706.2160 726.5010 625.0140 697.6770 759.7210
  614.8440 707.8090 719.6700 624.7800 698.1960 758.2440
  613.0760 709.3540 712.8270 624.2370 699.1850 755.2700
  623.8730 697.5170 758.1870 623.7870 699.8970 753.0260
  621.6000 699.9050 749.1590 623.3180 700.5950 750.7730
  619.3050 702.2020 740.1060 621.0260 703.8050 740.1240
  617.5700 703.8650 733.3010 619.2370 706.1010 732.1550
  615.8250 705.4800 726.4820 617.3650 708.2740 724.1720
  612.3020 708.5680 712.8090 615.4050 710.2880 716.2040
  623.0480 696.9460 758.1690 613.3430 712.1310 708.2160
  620.7800 699.2950 749.1410 612.9790 712.4170 706.8660
  618.4890 701.5540 740.0880 612.5880 712.6410 705.5560
  616.7570 703.1900 733.2830 612.1400 712.7640 704.2890
  615.0140 704.7790 726.4640 611.6130 712.7570 703.0730
  611.4950 707.8200 712.7920 611.3880 712.7030 702.6470
  621.8860 696.2300 758.1460 611.0040 712.5360 702.0680
  619.6230 698.5270 749.1180 610.3310 712.1280 701.3110
  617.3370 700.7360 740.0650 609.5860 711.5980 700.6980
  615.6090 702.3370 733.2590 609.1830 711.2970 700.4330
  613.8680 703.8930 726.4410 608.3830 710.6880 700.0150
  610.3540 706.8720 712.7690 607.0820 709.7100 699.5600
  621.2350 694.9970 760.3910 606.0220 708.9540 699.3290
  619.5520 696.7040 753.6400 604.3180 707.8500 699.1170
  617.8480 698.3680 746.8480 603.6580 707.4620 699.0680
  616.1300 699.9850 740.0420 602.9910 707.0930 699.0320
  612.6650 703.0760 726.4190 602.3150 706.7420 699.0060
  609.1540 705.9960 712.7480 601.4010 706.3030 698.9830
  619.9970 694.3910 760.4810 599.5250 705.5180 698.9790
  618.3440 696.0350 753.8420 598.0900 705.0120 699.0100
  616.6140 697.6920 746.9380 596.6280 704.5730 699.0630
  614.8700 699.3010 740.0210 595.1570 704.1990 699.1340
  611.4080 702.3300 726.3980 593.6660 703.8820 699.2200
  607.8980 705.1940 712.7280 592.1720 703.6200 699.3150
  619.0390 693.9780 760.5540 590.6650 703.4040 699.4200
  617.4090 695.5750 754.0040 587.6490 703.0830 699.6420
  615.6580 697.2280 747.0120 584.8690 702.8740 699.8560
  613.8930 698.8330 740.0050 587.8690 701.1170 710.5820
  610.4310 701.8170 726.3830 590.8420 699.2820 721.2860
  606.9210 704.6410 712.7140 593.7820 697.3710 731.9600
  618.0580 693.6000 760.6310 596.6880 695.3820 742.5930
  616.4510 695.1510 754.1730 597.4470 694.8450 745.3850
  614.6770 696.8010 747.0890 598.2380 694.2770 748.3010
  612.8890 698.4030 739.9910 600.6310 692.5030 757.1730
  609.4260 701.3440 726.3690 593.3530 694.0590 749.9870
  605.9150 704.1300 712.7010 591.4250 695.3940 742.8540
  616.2600 693.1570 760.3030 587.5530 697.9490 728.5500
  614.5750 694.7390 753.5380 583.6680 700.3650 714.1970
  611.1610 697.7720 739.9690 586.8360 695.0600 745.6420
  607.6940 700.6450 726.3480 583.7500 697.0510 734.2090
  604.1770 703.3710 712.6810 580.6550 698.9470 722.7460
  614.4850 692.7340 760.2830 577.5550 700.7530 711.2560
  612.7950 694.2790 753.5180 578.3940 697.2400 734.1420
  609.3730 697.2440 739.9490 575.3080 699.0370 722.6790
  605.8960 700.0550 726.3300 572.2180 700.7420 711.1900
  602.3690 702.7250 712.6640 574.3760 697.4280 734.0940
  612.6660 692.4020 760.2640 571.2970 699.1480 722.6300
  610.9690 693.9140 753.4990 568.2140 700.7710 711.1410
  607.5320 696.8160 739.9310 567.2850 699.2920 722.5810
  604.0400 699.5710 726.3130 564.2100 700.8300 711.0920
  600.4980 702.1900 712.6480 598.2380 694.2770 748.3010
  611.4290 692.2270 760.2520 597.4470 694.8450 745.3850
  609.7250 693.7190 753.4880 596.6880 695.3820 742.5930
  606.2740 696.5830 739.9200 593.7820 697.3710 731.9600
  602.7690 699.3030 726.3020 590.8420 699.2820 721.2860
  599.2140 701.8900 712.6390 587.8690 701.1170 710.5820
  610.1790 692.0890 760.2410 584.8690 702.8740 699.8560
  608.4670 693.5620 753.4770 579.0530 702.5320 700.3160
  605.0000 696.3910 739.9090 573.2360 702.2790 700.7930
  601.4790 699.0780 726.2920 568.8760 702.1390 701.1710
  597.9080 701.6340 712.6300 564.5230 702.0370 701.5860
  606.9210 693.4180 753.4630 561.6260 701.9870 701.8980
  603.4300 696.2070 739.8960 561.0450 701.9780 701.9670
  599.8850 698.8570 726.2800 560.1940 701.9640 702.0900
  596.2890 701.3780 712.6190 558.9590 701.9380 702.3430
  605.3660 693.3220 753.4500 558.1020 701.9120 702.5970
  601.8450 696.0740 739.8830 557.2910 701.8810 702.9270
  598.2710 698.6890 726.2680 557.0050 701.8670 703.0740
  594.6470 701.1780 712.6080 556.6180 701.8440 703.3130
  603.4370 693.2590 753.4320 556.1270 701.8040 703.7230
  599.8720 695.9710 739.8650 555.9700 701.7870 703.8920
  596.2540 698.5460 726.2500 555.7550 701.7600 704.1700
  592.5870 700.9960 712.5920 555.5710 701.7300 704.4690
  602.1540 693.2460 753.4190 555.4280 701.6980 704.7870
  598.5550 695.9330 739.8510 555.3200 701.6640 705.1240
  594.9030 698.4830 726.2370 555.2150 701.6100 705.6470
  591.2020 700.9070 712.5800 555.1770 701.5250 706.4660
  601.5030 692.3730 757.7440 555.2230 701.4630 707.0430
  602.2840 692.2590 758.2500 555.2660 701.4310 707.3380
  602.7130 692.1980 758.5250 555.5080 701.3160 708.3890
  603.1430 692.1380 758.8000 555.8510 701.1990 709.4140
  603.7850 692.0500 759.2070 556.2740 701.0820 710.4210
  604.4270 691.9660 759.6100 556.7580 700.9610 711.4280
  605.0710 691.8850 760.0100 559.0780 700.4080 715.8080
  605.7180 691.8080 760.4080 560.9480 699.9790 718.9800
  607.2110 691.6450 761.3140 562.9460 699.5330 722.0840
  609.4080 691.4560 762.6010 566.1430 698.8400 726.5600
  611.5760 691.3480 763.7860 569.5790 698.1180 730.8380
  613.7290 691.3390 764.8460 573.2460 697.3710 734.9260
  615.3360 691.4130 765.5440 577.1320 696.6030 738.8400
  616.6420 691.5320 766.0420 579.6210 696.1230 741.1620
  617.2980 691.6150 766.2660 580.8960 695.8810 742.3040
  617.9120 691.7080 766.4580 584.7060 695.1730 745.5510
  618.8350 691.8800 766.7070 588.6780 694.4610 748.7100
  620.2080 692.2190 766.9810 592.8010 693.7520 751.7860
  621.1890 692.5320 767.0910 596.1120 693.2070 754.1300
  622.1560 692.9120 767.1150 599.5100 692.6740 756.4310
  622.9460 693.2880 767.0530 600.6310 692.5030 757.1730
  623.6400 693.7030 766.8620 0 0 0];
p=[p(:,1:3);p(:,4:6)];p=p(1:end-1,:);

t=[ 125 124 126 1 2 130 150 57 62
   124 5 126 130 2 3 150 62 151
   126 5 127 93 89 92 4 10 138
     5 6 127 89 88 92 4 138 137
   127 6 7 92 88 91 4 137 136
   103 78 104 88 87 91 4 136 135
    78 73 104 91 87 90 4 135 134
   104 73 105 87 86 90 4 134 133
    73 68 105 89 85 88 4 133 132
   105 68 106 85 84 88 4 132 131
    68 63 106 88 84 87 4 131 130
   106 63 107 84 83 87 4 130 3
    63 58 107 87 83 86 90 86 101
   159 158 93 83 82 86 90 101 100
   158 157 93 85 81 84 90 100 99
    93 157 89 81 80 84 90 99 98
   157 156 89 84 80 83 90 98 97
    89 156 85 80 79 83 90 97 96
   151 62 152 83 79 82 90 96 95
    62 67 152 79 78 82 90 95 94
   152 67 153 81 77 80 90 94 165
    67 72 153 77 76 80 90 165 164
   153 72 154 80 76 79 90 164 163
    72 77 154 76 75 79 90 163 162
   154 77 155 79 75 78 90 162 91
    77 81 155 75 74 78 128 1 129
   155 81 156 78 74 73 160 159 93
    81 85 156 77 72 76 93 92 160
   110 109 111 72 71 76 161 160 92
   109 47 111 76 71 75 92 91 161
   111 47 112 71 70 75 162 161 91
    47 41 112 75 70 74 118 120 119
   112 41 113 70 69 74 140 16 141
    41 35 113 74 69 73 138 10 139
   113 35 29 69 68 73 188 187 189
   147 146 52 72 67 71 187 169 189
   146 46 52 67 66 71 189 169 190
    52 46 51 71 66 70 169 173 190
    46 45 51 66 65 70 190 173 191
    51 45 50 70 65 69 173 176 191
    45 44 50 65 64 69 191 176 192
    50 44 49 69 64 68 176 179 192
    44 43 49 64 63 68 168 185 167
    49 43 48 67 62 66 185 184 167
    43 42 48 62 61 66 167 184 183
    48 42 47 66 61 65 183 182 167
    42 41 47 61 60 65 182 166 167
   114 113 115 65 60 64 179 176 178
   113 29 115 60 59 64 176 175 178
   115 29 23 64 59 63 178 175 177
   144 143 34 59 58 63 175 174 177
   143 28 34 62 57 61 176 173 175
    34 28 33 57 56 61 173 172 175
    28 27 33 61 56 60 175 172 174
    33 27 32 56 55 60 172 171 174
    27 26 32 60 55 59 222 221 177
    32 26 25 55 54 59 222 177 174
   116 115 117 59 54 58 222 174 170
   115 23 117 54 53 58 222 170 223
   117 23 17 57 52 56 177 221 220
   143 142 28 52 51 56 177 220 219
   142 22 28 56 51 55 177 219 218
    28 22 27 51 50 55 177 218 180
    22 21 27 55 50 54 177 180 178
    27 21 26 50 49 54 170 174 171
    21 20 26 54 49 48 170 171 167
    26 20 25 48 47 54 170 167 166
    20 19 25 47 53 54 170 166 225
    25 19 24 46 40 45 170 225 224
    19 18 24 40 39 45 170 224 223
    24 18 23 45 39 44 229 228 227
    18 17 23 39 38 44 229 227 226
   123 122 11 44 38 43 229 226 166
   122 121 11 38 37 43 229 166 182
    11 121 17 43 37 42 181 214 213
   121 120 17 37 36 42 181 213 212
    17 120 117 42 36 41 181 212 211
   120 118 117 36 35 41 181 211 210
   142 141 22 40 34 39 181 210 209
   141 16 22 34 33 39 181 209 208
    22 16 21 39 33 38 181 208 207
    16 15 21 33 32 38 181 207 206
    21 15 20 38 32 37 181 206 205
    15 14 20 32 31 37 181 205 204
    20 14 19 37 31 36 181 204 203
    14 13 19 31 30 36 181 203 202
    19 13 18 36 30 35 181 202 201
    13 12 18 30 29 35 181 201 200
    18 12 17 32 25 31 181 200 199
    12 11 17 25 24 31 181 199 198
   140 139 16 31 24 30 181 198 197
   139 10 16 24 23 30 181 197 196
    16 10 15 30 23 29 181 196 195
    10 9 15 7 14 8 181 195 194
    15 9 8 14 15 8 181 194 193
   124 123 5 102 101 86 181 193 192
   123 11 5 102 86 82 181 192 179
     5 11 6 102 82 78 181 179 178
    11 12 6 102 78 103 181 178 180
     6 12 7 108 107 58 180 218 217
    12 13 7 108 58 53 180 217 216
     7 13 14 108 53 47 180 216 215
   128 127 1 108 47 109 180 215 214
   127 7 1 145 144 34 180 214 181
     1 7 2 145 34 40 169 187 186
     7 8 2 145 40 46 169 186 168
     2 8 3 145 46 146 186 185 168
     8 9 3 148 147 52 172 173 169
     3 9 4 148 52 57 169 168 172
     9 10 4 148 57 149 171 172 168
   129 1 130 150 149 57 168 167 171];
t=[t(:,1:3);t(:,4:6);t(:,7:9);[226,225,166]];
patch('Vertices',p,'Faces',t,'FaceColor','w','EdgeColor','k');

Viewing all articles
Browse latest Browse all 5

Trending Articles