vedo.pointcloud

core
Points
Bases: PointsVisual, PointAlgorithms, PointTransformMixin, PointAnalyzeMixin, PointReconstructMixin, PointCutMixin
Work with point clouds.
Source code in vedo/pointcloud/core.py
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 | |
clone(deep=True)
Clone a PointCloud or Mesh object to make an exact copy of it.
Alias of copy().
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
deep
|
bool
|
if False return a shallow copy of the mesh without copying the points array. |
True
|
Examples:

Source code in vedo/pointcloud/core.py
459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 | |
copy(deep=True)
Return a copy of the object. Alias of clone().
Source code in vedo/pointcloud/core.py
455 456 457 | |
polydata()
Obsolete. Use property .dataset instead.
Returns the underlying vtkPolyData object.
Source code in vedo/pointcloud/core.py
439 440 441 442 443 444 445 446 447 | |
print()
Print object info.
Source code in vedo/pointcloud/core.py
334 335 336 337 | |
Point(pos=(0, 0, 0), r=12, c='red', alpha=1.0)
Build a point at position of radius size r, color c and transparency alpha.
Source code in vedo/pointcloud/core.py
35 36 37 | |
analyze
PointAnalyzeMixin
Source code in vedo/pointcloud/analyze.py
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 | |
point_normals
property
Retrieve vertex normals as a numpy array. Same as vertex_normals.
Check out also compute_normals() and compute_normals_with_pca().
vertex_normals
property
Retrieve vertex normals as a numpy array. Same as point_normals.
If needed, normals are computed via compute_normals_with_pca().
Check out also compute_normals() and compute_normals_with_pca().
auto_distance()
Calculate the distance to the closest point in the same cloud of points. The output is stored in a new pointdata array called "AutoDistance", and it is also returned by the function.
Source code in vedo/pointcloud/analyze.py
449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 | |
chamfer_distance(pcloud)
Compute the Chamfer distance to the input point set.
Examples:
from vedo import *
cloud1 = np.random.randn(1000, 3)
cloud2 = np.random.randn(1000, 3) + [1, 2, 3]
c1 = Points(cloud1, r=5, c="red")
c2 = Points(cloud2, r=5, c="green")
d = c1.chamfer_distance(c2)
show(f"Chamfer distance = {d}", c1, c2, axes=1).close()
Source code in vedo/pointcloud/analyze.py
509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 | |
clean()
Clean pointcloud or mesh by removing coincident points.
Source code in vedo/pointcloud/analyze.py
184 185 186 187 188 189 190 191 192 193 194 195 196 197 | |
closest_point(pt, n=1, radius=None, return_point_id=False, return_cell_id=False)
Find the closest point(s) on a mesh given from the input point pt.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
n
|
int
|
if greater than 1, return a list of n ordered closest points |
1
|
radius
|
float
|
if given, get all points within that radius. Then n is ignored. |
None
|
return_point_id
|
bool
|
return point ID instead of coordinates |
False
|
return_cell_id
|
bool
|
return cell ID in which the closest point sits |
False
|
Examples:
.. note:: The appropriate tree search locator is built on the fly and cached for speed.
If you want to reset it use `mymesh.point_locator=None`
and / or `mymesh.cell_locator=None`.
Source code in vedo/pointcloud/analyze.py
346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 | |
compute_acoplanarity(n=25, radius=None, on='points')
Compute acoplanarity which is a measure of how much a local region of the mesh differs from a plane.
The information is stored in a pointdata or celldata array with name 'Acoplanarity'.
Either n (number of neighbour points) or radius (radius of local search) can be specified.
If a radius value is given and not enough points fall inside it, then a -1 is stored.
Examples:
from vedo import *
msh = ParametricShape('RandomHills')
msh.compute_acoplanarity(radius=0.1, on='cells')
msh.cmap("coolwarm", on='cells').add_scalarbar()
msh.show(axes=1).close()
Source code in vedo/pointcloud/analyze.py
61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 | |
compute_camera_distance()
Calculate the distance from points to the camera.
A pointdata array is created with name 'DistanceToCamera' and returned.
Source code in vedo/pointcloud/analyze.py
1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 | |
compute_clustering(radius)
Cluster points in space. The radius is the radius of local search.
An array named "ClusterId" is added to pointdata.
Examples:
Source code in vedo/pointcloud/analyze.py
927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 | |
compute_connections(radius, mode=0, regions=(), vrange=(0, 1), seeds=(), angle=0.0)
Extracts and/or segments points from a point cloud based on geometric distance measures (e.g., proximity, normal alignments, etc.) and optional measures such as scalar range. The default operation is to segment the points into "connected" regions where the connection is determined by an appropriate distance measure. Each region is given a region id.
Optionally, the filter can output the largest connected region of points; a particular region (via id specification); those regions that are seeded using a list of input point ids; or the region of points closest to a specified position.
The key parameter of this filter is the radius defining a sphere around each point which defines a local neighborhood: any other points in the local neighborhood are assumed connected to the point. Note that the radius is defined in absolute terms.
Other parameters are used to further qualify what it means to be a neighboring point. For example, scalar range and/or point normals can be used to further constrain the neighborhood. Also the extraction mode defines how the filter operates. By default, all regions are extracted but it is possible to extract particular regions; the region closest to a seed point; seeded regions; or the largest region found while processing. By default, all regions are extracted.
On output, all points are labeled with a region number. However note that the number of input and output points may not be the same: if not extracting all regions then the output size may be less than the input size.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
radius
|
float
|
variable specifying a local sphere used to define local point neighborhood |
required |
mode
|
int
|
|
0
|
regions
|
list
|
a list of non-negative regions id to extract |
()
|
vrange
|
list
|
scalar range to use to extract points based on scalar connectivity |
(0, 1)
|
seeds
|
list
|
a list of non-negative point seed ids |
()
|
angle
|
list
|
points are connected if the angle between their normals is within this angle threshold (expressed in degrees). |
0.0
|
Source code in vedo/pointcloud/analyze.py
951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 | |
compute_normals_with_pca(n=20, orientation_point=None, invert=False)
Generate point normals using PCA (principal component analysis). This algorithm estimates a local tangent plane around each sample point p by considering a small neighborhood of points around p, and fitting a plane to the neighborhood (via PCA).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
n
|
int
|
neighborhood size to calculate the normal |
20
|
orientation_point
|
list
|
adjust the +/- sign of the normals so that the normals all point towards a specified point. If None, perform a traversal of the point cloud and flip neighboring normals so that they are mutually consistent. |
None
|
invert
|
bool
|
flip all normals |
False
|
Source code in vedo/pointcloud/analyze.py
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 | |
densify(target_distance=0.1, nclosest=6, radius=None, niter=1, nmax=None)
Return a copy of the cloud with new added points. The new points are created in such a way that all points in any local neighborhood are within a target distance of one another.
For each input point, the distance to all points in its neighborhood is computed. If any of its neighbors is further than the target distance, the edge connecting the point and its neighbor is bisected and a new point is inserted at the bisection point. A single pass is completed once all the input points are visited. Then the process repeats to the number of iterations.
Examples:
.. note:: Points will be created in an iterative fashion until all points in their local neighborhood are the target distance apart or less. Note that the process may terminate early due to the number of iterations. By default the target distance is set to 0.5. Note that the target_distance should be less than the radius or nothing will change on output.
.. warning::
This class can generate a lot of points very quickly.
The maximum number of iterations is by default set to =1.0 for this reason.
Increase the number of iterations very carefully.
Also, nmax can be set to limit the explosion of points.
It is also recommended that a N closest neighborhood is used.
Source code in vedo/pointcloud/analyze.py
1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 | |
density(dims=(40, 40, 40), bounds=None, radius=None, compute_gradient=False, locator=None)
Generate a density field from a point cloud. Input can also be a set of 3D coordinates.
Output is a Volume.
The local neighborhood is specified as the radius around each sample position (each voxel).
If left to None, the radius is automatically computed as the diagonal of the bounding box
and can be accessed via vol.metadata["radius"].
The density is expressed as the number of counts in the radius search.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
dims
|
(int, list)
|
number of voxels in x, y and z of the output Volume. |
(40, 40, 40)
|
compute_gradient
|
bool
|
Turn on/off the generation of the gradient vector, gradient magnitude scalar, and function classification scalar. By default this is off. Note that this will increase execution time and the size of the output. (The names of these point data arrays are: "Gradient", "Gradient Magnitude", and "Classification") |
False
|
locator
|
vtkPointLocator
|
can be assigned from a previous call for speed (access it via |
None
|
Examples:
Source code in vedo/pointcloud/analyze.py
1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 | |
distance_to(pcloud, signed=False, invert=False, name='Distance')
Computes the distance from one point cloud or mesh to another point cloud or mesh.
This new pointdata array is saved with default name "Distance".
Keywords signed and invert are used to compute signed distance,
but the mesh in that case must have polygonal faces (not a simple point cloud),
and normals must also be computed.
Examples:
Source code in vedo/pointcloud/analyze.py
118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 | |
hausdorff_distance(points)
Compute the Hausdorff distance to the input point set.
Returns a single float.
Examples:
from vedo import *
t = np.linspace(0, 2*np.pi, 100)
x = 4/3 * sin(t)**3
y = cos(t) - cos(2*t)/3 - cos(3*t)/6 - cos(4*t)/12
pol1 = Line(np.c_[x,y], closed=True).triangulate()
pol2 = Polygon(nsides=5).pos(2,2)
d12 = pol1.distance_to(pol2)
d21 = pol2.distance_to(pol1)
pol1.lw(0).cmap("viridis")
pol2.lw(0).cmap("viridis")
print("distance d12, d21 :", min(d12), min(d21))
print("hausdorff distance:", pol1.hausdorff_distance(pol2))
print("chamfer distance :", pol1.chamfer_distance(pol2))
show(pol1, pol2, axes=1)
Source code in vedo/pointcloud/analyze.py
478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 | |
quantize(value)
The user should input a value and all {x,y,z} coordinates will be quantized to that absolute grain size.
Source code in vedo/pointcloud/analyze.py
309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 | |
relax_point_positions(n=10, iters=10, sub_iters=10, packing_factor=1, max_step=0, constraints=None)
Smooth mesh or points with a Laplacian algorithm variant. This modifies the coordinates of the input points by adjusting their positions to create a smooth distribution (and thereby form a pleasing packing of the points). Smoothing is performed by considering the effects of neighboring points on one another it uses a cubic cutoff function to produce repulsive forces between close points and attractive forces that are a little further away.
In general, the larger the neighborhood size, the greater the reduction in high frequency information. The memory and computational requirements of the algorithm may also significantly increase.
The algorithm incrementally adjusts the point positions through an iterative process. Basically points are moved due to the influence of neighboring points.
As points move, both the local connectivity and data attributes associated with each point must be updated. Rather than performing these expensive operations after every iteration, a number of sub-iterations can be specified. If so, then the neighborhood and attribute value updates occur only every sub iteration, which can improve performance significantly.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
n
|
int
|
neighborhood size to calculate the Laplacian. |
10
|
iters
|
int
|
number of iterations. |
10
|
sub_iters
|
int
|
number of sub-iterations, i.e. the number of times the neighborhood and attribute value updates occur during each iteration. |
10
|
packing_factor
|
float
|
adjust convergence speed. |
1
|
max_step
|
float
|
Specify the maximum smoothing step size for each smoothing iteration. This limits the the distance over which a point can move in each iteration. As in all iterative methods, the stability of the process is sensitive to this parameter. In general, small step size and large numbers of iterations are more stable than a larger step size and a smaller numbers of iterations. |
0
|
constraints
|
dict
|
dictionary of constraints.
Point constraints are used to prevent points from moving,
or to move only on a plane. This can prevent shrinking or growing point clouds.
If enabled, a local topological analysis is performed to determine whether a point
should be marked as fixed" i.e., never moves, or the point only moves on a plane,
or the point can move freely.
If all points in the neighborhood surrounding a point are in the cone defined by
|
None
|
Examples:
import numpy as np
from vedo import Points, show
from vedo.pyplot import histogram
vpts1 = Points(np.random.rand(10_000, 3))
dists = vpts1.auto_distance()
h1 = histogram(dists, xlim=(0,0.08)).clone2d()
vpts2 = vpts1.clone().relax_point_positions(n=100, iters=20, sub_iters=10)
dists = vpts2.auto_distance()
h2 = histogram(dists, xlim=(0,0.08)).clone2d()
show([[vpts1, h1], [vpts2, h2]], N=2).close()
Source code in vedo/pointcloud/analyze.py
588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 | |
remove_outliers(radius, neighbors=5)
Remove outliers from a cloud of points within the specified radius search.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
radius
|
float
|
Specify the local search radius. |
required |
neighbors
|
int
|
Specify the number of neighbors that a point must have, within the specified radius, for the point to not be considered isolated. |
5
|
Examples:
Source code in vedo/pointcloud/analyze.py
555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 | |
smooth_lloyd_2d(iterations=2, bounds=None, options='Qbb Qc Qx')
Lloyd relaxation of a 2D pointcloud.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
iterations
|
int
|
number of iterations. |
2
|
bounds
|
list
|
bounding box of the domain. |
None
|
options
|
str
|
options for the Qhull algorithm. |
'Qbb Qc Qx'
|
Source code in vedo/pointcloud/analyze.py
839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 | |
smooth_mls_1d(f=0.2, radius=None, n=0)
Smooth mesh or points with a Moving Least Squares variant.
The point data array "Variances" will contain the residue calculated for each point.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
f
|
float
|
smoothing factor - typical range is [0,2]. |
0.2
|
radius
|
float
|
radius search in absolute units.
If set then |
None
|
n
|
int
|
number of neighbours to be used for the fit.
If set then |
0
|
Examples:

Source code in vedo/pointcloud/analyze.py
690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 | |
smooth_mls_2d(f=0.2, radius=None, n=0)
Smooth mesh or points with a Moving Least Squares algorithm variant.
The mesh.pointdata['MLSVariance'] array will contain the residue calculated for each point.
When a radius is specified, points that are isolated will not be moved and will get
a 0 entry in array mesh.pointdata['MLSValidPoint'].
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
f
|
float
|
smoothing factor - typical range is [0, 2]. |
0.2
|
radius
|
float | array
|
radius search in absolute units. Can be single value (float) or sequence
for adaptive smoothing. If set then |
None
|
n
|
int
|
number of neighbours to be used for the fit.
If set then |
0
|
Examples:
Source code in vedo/pointcloud/analyze.py
748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 | |
subsample(fraction, absolute=False)
Subsample a point cloud by requiring that the points or vertices are far apart at least by the specified fraction of the object size. If a Mesh is passed the polygonal faces are not removed but holes can appear as their vertices are removed.
Examples:
Source code in vedo/pointcloud/analyze.py
199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 | |
threshold(scalars, above=None, below=None, on='points')
Extracts cells where scalar value satisfies threshold criterion.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
scalars
|
str
|
name of the scalars array. |
required |
above
|
float
|
minimum value of the scalar |
None
|
below
|
float
|
maximum value of the scalar |
None
|
on
|
str
|
if 'cells' assume array of scalars refers to cell data. |
'points'
|
Examples:
Source code in vedo/pointcloud/analyze.py
250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 | |
visible_points(area=(), tol=None, invert=False)
Extract points based on whether they are visible or not. Visibility is determined by accessing the z-buffer of a rendering window. The position of each input point is converted into display coordinates, and then the z-value at that point is obtained. If within the user-specified tolerance, the point is considered visible. Associated data attributes are passed to the output as well.
This filter also allows you to specify a rectangular window in display (pixel) coordinates in which the visible points must lie.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
area
|
list
|
specify a rectangular region as (xmin,xmax,ymin,ymax) |
()
|
tol
|
float
|
a tolerance in normalized display coordinate system |
None
|
invert
|
bool
|
select invisible points instead. |
False
|
Examples:
from vedo import Ellipsoid, show
s = Ellipsoid().rotate_y(30)
# Camera options: pos, focal_point, viewup, distance
camopts = dict(pos=(0,0,25), focal_point=(0,0,0))
show(s, camera=camopts, offscreen=True)
m = s.visible_points()
# print('visible pts:', m.vertices) # numpy array
show(m, new=True, axes=1).close() # optionally draw result in a new window
Source code in vedo/pointcloud/analyze.py
1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 | |
cut
PointCutMixin
Source code in vedo/pointcloud/cut.py
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 | |
crop(top=None, bottom=None, right=None, left=None, front=None, back=None, bounds=())
Crop an Mesh object.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
top
|
float
|
fraction to crop from the top plane (positive z) |
None
|
bottom
|
float
|
fraction to crop from the bottom plane (negative z) |
None
|
front
|
float
|
fraction to crop from the front plane (positive y) |
None
|
back
|
float
|
fraction to crop from the back plane (negative y) |
None
|
right
|
float
|
fraction to crop from the right plane (positive x) |
None
|
left
|
float
|
fraction to crop from the left plane (negative x) |
None
|
bounds
|
list
|
bounding box of the crop region as |
()
|
Examples:
from vedo import Sphere
Sphere().crop(right=0.3, left=0.1).show()
Source code in vedo/pointcloud/cut.py
584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 | |
cut_with_box(bounds, invert=False)
Cut the current mesh with a box or a set of boxes.
This is much faster than cut_with_mesh().
Input bounds can be either:
- a Mesh or Points object
- a list of 6 number representing a bounding box [xmin,xmax, ymin,ymax, zmin,zmax]
- a list of bounding boxes like the above: [[xmin1,...], [xmin2,...], ...]
Examples:
from vedo import Sphere, Cube, show
mesh = Sphere(r=1, res=50)
box = Cube(side=1.5).wireframe()
mesh.cut_with_box(box)
show(mesh, box, axes=1).close()
Check out also
cut_with_line(), cut_with_plane(), cut_with_cylinder()
Source code in vedo/pointcloud/cut.py
140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 | |
cut_with_cookiecutter(lines)
Cut the current mesh with a single line or a set of lines.
Input lines can be either:
- a Mesh or Points object
- a list of 3D points: [(x1,y1,z1), (x2,y2,z2), ...]
- a list of 2D points: [(x1,y1), (x2,y2), ...]
Examples:
from vedo import *
grid = Mesh(dataurl + "dolfin_fine.vtk")
grid.compute_quality().cmap("Greens")
pols = merge(
Polygon(nsides=10, r=0.3).pos(0.7, 0.3),
Polygon(nsides=10, r=0.2).pos(0.3, 0.7),
)
lines = pols.boundaries()
cgrid = grid.clone().cut_with_cookiecutter(lines)
grid.alpha(0.1).wireframe()
show(grid, cgrid, lines, axes=8, bg='blackboard').close()
Check out also
cut_with_line() and cut_with_point_loop()
Note
In case of a warning message like: "Mesh and trim loop point data attributes are different" consider interpolating the mesh point data to the loop points, Eg. (in the above example):
lines = pols.boundaries().interpolate_data_from(grid, n=2)
Note
trying to invert the selection by reversing the loop order
will have no effect in this method, hence it does not have
the invert option.
Source code in vedo/pointcloud/cut.py
231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 | |
cut_with_cylinder(center=(0, 0, 0), axis=(0, 0, 1), r=1, invert=False)
Cut the current mesh with an infinite cylinder.
This is much faster than cut_with_mesh().
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
center
|
array
|
the center of the cylinder |
(0, 0, 0)
|
normal
|
array
|
direction of the cylinder axis |
required |
r
|
float
|
radius of the cylinder |
1
|
Examples:
from vedo import Disc, show
disc = Disc(r1=1, r2=1.2)
mesh = disc.extrude(3, res=50).linewidth(1)
mesh.cut_with_cylinder([0,0,2], r=0.4, axis='y', invert=True)
show(mesh, axes=1).close()
Examples:
Check out also
cut_with_box(), cut_with_plane(), cut_with_sphere()
Source code in vedo/pointcloud/cut.py
307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 | |
cut_with_line(points, invert=False, closed=True)
Cut the current mesh with a line vertically in the z-axis direction like a cookie cutter.
The polyline is defined by a set of points (z-coordinates are ignored).
This is much faster than cut_with_mesh().
Check out also
cut_with_box(), cut_with_plane(), cut_with_sphere()
Source code in vedo/pointcloud/cut.py
186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 | |
cut_with_mesh(mesh, invert=False, keep=False)
Cut an Mesh mesh with another Mesh.
Use invert to invert the selection.
Use keep to keep the cutoff part, in this case an Assembly is returned:
the "cut" object and the "discarded" part of the original object.
You can access both via assembly.unpack() method.
Examples:
from vedo import *
arr = np.random.randn(100000, 3)/2
pts = Points(arr).c('red3').pos(5,0,0)
cube = Cube().pos(4,0.5,0)
assem = pts.cut_with_mesh(cube, keep=True)
show(assem.unpack(), axes=1).close()
Check out also
cut_with_box(), cut_with_plane(), cut_with_cylinder()
Source code in vedo/pointcloud/cut.py
403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 | |
cut_with_plane(origin=(0, 0, 0), normal=(1, 0, 0), invert=False)
Cut the mesh with the plane defined by a point and a normal.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
origin
|
array
|
the cutting plane goes through this point |
(0, 0, 0)
|
normal
|
array
|
normal of the cutting plane |
(1, 0, 0)
|
invert
|
bool
|
select which side of the plane to keep |
False
|
Examples:
from vedo import Cube
cube = Cube().cut_with_plane(normal=(1,1,1))
cube.back_color('pink').show().close()
Examples:
Check out also
cut_with_box(), cut_with_cylinder(), cut_with_sphere().
Source code in vedo/pointcloud/cut.py
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 | |
cut_with_planes(origins, normals, invert=False)
Cut the mesh with a convex set of planes defined by points and normals.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
origins
|
array
|
each cutting plane goes through this point |
required |
normals
|
array
|
normal of each of the cutting planes |
required |
invert
|
bool
|
if True, cut outside instead of inside |
False
|
Check out also
cut_with_box(), cut_with_cylinder(), cut_with_sphere()
Source code in vedo/pointcloud/cut.py
101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 | |
cut_with_point_loop(points, invert=False, on='points', include_boundary=False)
Cut an Mesh object with a set of points forming a closed loop.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
invert
|
bool
|
invert selection (inside-out) |
False
|
on
|
str
|
if 'cells' will extract the whole cells lying inside (or outside) the point loop |
'points'
|
include_boundary
|
bool
|
include cells lying exactly on the boundary line. Only relevant on 'cells' mode |
False
|
Examples:
Source code in vedo/pointcloud/cut.py
487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 | |
cut_with_scalar(value, name='', invert=False)
Cut a mesh or point cloud with some input scalar point-data.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
value
|
float
|
cutting value |
required |
name
|
str
|
array name of the scalars to be used |
''
|
invert
|
bool
|
flip selection |
False
|
Examples:
from vedo import *
s = Sphere().lw(1)
pts = s.points
scalars = np.sin(3*pts[:,2]) + pts[:,0]
s.pointdata["somevalues"] = scalars
s.cut_with_scalar(0.3)
s.cmap("Spectral", "somevalues").add_scalarbar()
s.show(axes=1).close()
Source code in vedo/pointcloud/cut.py
547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 | |
cut_with_sphere(center=(0, 0, 0), r=1.0, invert=False)
Cut the current mesh with an sphere.
This is much faster than cut_with_mesh().
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
center
|
array
|
the center of the sphere |
(0, 0, 0)
|
r
|
float
|
radius of the sphere |
1.0
|
Examples:
from vedo import Disc, show
disc = Disc(r1=1, r2=1.2)
mesh = disc.extrude(3, res=50).linewidth(1)
mesh.cut_with_sphere([1,-0.7,2], r=1.5, invert=True)
show(mesh, axes=1).close()
Check out also
cut_with_box(), cut_with_plane(), cut_with_cylinder()
Source code in vedo/pointcloud/cut.py
363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 | |
fits
Point(pos=(0, 0, 0), r=12, c='red', alpha=1.0)
Build a point at position of radius size r, color c and transparency alpha.
Source code in vedo/pointcloud/core.py
35 36 37 | |
fit_circle(points)
Fits a circle through a set of 3D points, with a very fast non-iterative method.
Returns the tuple (center, radius, normal_to_circle).
.. warning:: trying to fit s-shaped points will inevitably lead to instabilities and circles of small radius.
References
J.F. Crawford, Nucl. Instr. Meth. 211, 1983, 223-225.
Source code in vedo/pointcloud/fits.py
161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 | |
fit_line(points)
Fits a line through points.
Extra info is stored in Line.slope, Line.center, Line.variances.
Examples:
Source code in vedo/pointcloud/fits.py
129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 | |
fit_plane(points, signed=False)
Fits a plane to a set of points.
Extra info is stored in Plane.normal, Plane.center, Plane.variance.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
signed
|
bool
|
if True flip sign of the normal based on the ordering of the points |
False
|
Examples:
Source code in vedo/pointcloud/fits.py
223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 | |
fit_sphere(coords)
Fits a sphere to a set of points.
Extra info is stored in Sphere.radius, Sphere.center, Sphere.residue.
Examples:
Source code in vedo/pointcloud/fits.py
421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 | |
merge(*meshs, flag=False)
Build a new Mesh (or Points) formed by the fusion of the inputs.
Similar to Assembly, but in this case the input objects become a single entity.
To keep track of the original identities of the inputs you can set flag=True.
In this case a pointdata array of ids is added to the output with name "OriginalMeshID".
Examples:
Source code in vedo/pointcloud/fits.py
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 | |
pca_ellipse(points, pvalue=0.673, res=60)
Create the oriented 2D ellipse that contains the fraction pvalue of points.
PCA (Principal Component Analysis) is used to compute the ellipse orientation.
Parameter pvalue sets the specified fraction of points inside the ellipse.
Normalized directions are stored in ellipse.axis1, ellipse.axis2.
Axes sizes are stored in ellipse.va, ellipse.vb
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
pvalue
|
float
|
ellipse will include this fraction of points |
0.673
|
res
|
int
|
resolution of the ellipse |
60
|
Examples:
Source code in vedo/pointcloud/fits.py
465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 | |
pca_ellipsoid(points, pvalue=0.673, res=24)
Create the oriented ellipsoid that contains the fraction pvalue of points.
PCA (Principal Component Analysis) is used to compute the ellipsoid orientation.
Axes sizes can be accessed in ellips.va, ellips.vb, ellips.vc,
normalized directions are stored in ellips.axis1, ellips.axis2 and ellips.axis3.
Center of mass is stored in ellips.center.
Asphericity can be accessed in ellips.asphericity() and ellips.asphericity_error().
A value of 0 means a perfect sphere.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
pvalue
|
float
|
ellipsoid will include this fraction of points |
0.673
|
Examples:

See also
pca_ellipse() for a 2D ellipse.
Source code in vedo/pointcloud/fits.py
528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 | |
project_point_on_variety(pt, points, degree=3, compute_surface=False, compute_curvature=False)
Project a point in 3D space onto a polynomial surface defined by a set of points around it. The polynomial degree can be adjusted.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
pt
|
list or ndarray
|
The point to smooth (3D coordinates). |
required |
points
|
ndarray
|
A set of points (Nx3 array) to fit the polynomial surface. |
required |
degree
|
int
|
The degree of the polynomial to fit. |
3
|
compute_surface
|
bool
|
If True, returns a surface mesh of the fitted polynomial. |
False
|
Returns:
| Name | Type | Description |
|---|---|---|
transformed_pt |
ndarray
|
The projected point on the polynomial surface. |
surface_data |
tuple
|
If compute_surface is True, the first element is a vedo.Grid object representing the surface. If compute_curvature is True, the second element contains curvature information. Contains the fitted polynomial coefficients, rotation matrix, and centroid. |
Examples:
import vedo
from vedo.pointcloud import project_point_on_variety
mesh = vedo.Mesh(vedo.dataurl+"bunny.obj").subdivide().scale(100)
mesh.wireframe().alpha(0.1)
pt = mesh.coordinates[30]
points = mesh.closest_point(pt, n=200)
pt_trans, res = project_point_on_variety(pt, points, degree=3, compute_surface=True)
vpoints = vedo.Points(points, r=6, c="yellow2")
plotter = vedo.Plotter(size=(1200, 800))
plotter += mesh, vedo.Point(pt), vpoints, res[0], f"Residue: {pt - pt_trans}"
plotter.show(axes=1).close()
Check out also the fit_plane() function for a simpler case of plane fitting.
Source code in vedo/pointcloud/fits.py
263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 | |
reconstruct
PointReconstructMixin
Source code in vedo/pointcloud/reconstruct.py
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 | |
generate_delaunay2d(mode='scipy', boundaries=(), tol=None, alpha=0.0, offset=0.0, transform=None)
Create a mesh from points in the XY plane.
If mode='fit' then the filter computes a best fitting
plane and projects the points onto it.
Check also generate_mesh().
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
tol
|
float
|
specify a tolerance to control discarding of closely spaced points. This tolerance is specified as a fraction of the diagonal length of the bounding box of the points. |
None
|
alpha
|
float
|
for a non-zero alpha value, only edges or triangles contained within a sphere centered at mesh vertices will be output. Otherwise, only triangles will be output. |
0.0
|
offset
|
float
|
multiplier to control the size of the initial, bounding Delaunay triangulation. |
0.0
|
transform
|
(LinearTransform, NonLinearTransform)
|
a transformation which is applied to points to generate a 2D problem. This maps a 3D dataset into a 2D dataset where triangulation can be done on the XY plane. The points are transformed and triangulated. The topology of triangulated points is used as the output topology. |
None
|
Examples:
Source code in vedo/pointcloud/reconstruct.py
452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 | |
generate_delaunay3d(radius=0, tol=None)
Create 3D Delaunay triangulation of input points.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
radius
|
float
|
specify distance (or "alpha") value to control output. For a non-zero values, only tetra contained within the circumsphere will be output. |
0
|
tol
|
float
|
Specify a tolerance to control discarding of closely spaced points. This tolerance is specified as a fraction of the diagonal length of the bounding box of the points. |
None
|
Source code in vedo/pointcloud/reconstruct.py
641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 | |
generate_mesh(line_resolution=None, mesh_resolution=None, smooth=0.0, jitter=0.001, grid=None, quads=False, invert=False)
Generate a polygonal Mesh from a closed contour line. If line is not closed it will be closed with a straight segment.
Check also generate_delaunay2d().
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
line_resolution
|
int
|
resolution of the contour line. The default is None, in this case the contour is not resampled. |
None
|
mesh_resolution
|
int
|
resolution of the internal triangles not touching the boundary. |
None
|
smooth
|
float
|
smoothing of the contour before meshing. |
0.0
|
jitter
|
float
|
add a small noise to the internal points. |
0.001
|
grid
|
Grid
|
manually pass a Grid object. The default is True. |
None
|
quads
|
bool
|
generate a mesh of quads instead of triangles. |
False
|
invert
|
bool
|
flip the line orientation. The default is False. |
False
|
Examples:
Source code in vedo/pointcloud/reconstruct.py
62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 | |
generate_segments(istart=0, rmax=1e+30, niter=3)
Generate a line segments from a set of points. The algorithm is based on the closest point search.
Returns a Line object.
This object contains the a metadata array of used vertex counts in "UsedVertexCount"
and the sum of the length of the segments in "SegmentsLengthSum".
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
istart
|
int
|
index of the starting point |
0
|
rmax
|
float
|
maximum length of a segment |
1e+30
|
niter
|
int
|
number of iterations or passes through the points |
3
|
Examples:
Source code in vedo/pointcloud/reconstruct.py
397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 | |
generate_surface_halo(distance=0.05, res=(50, 50, 50), bounds=(), maxdist=None)
Generate the surface halo which sits at the specified distance from the input one.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
distance
|
float
|
distance from the input surface |
0.05
|
res
|
int
|
resolution of the surface |
(50, 50, 50)
|
bounds
|
list
|
bounding box of the surface |
()
|
maxdist
|
float
|
maximum distance to generate the surface |
None
|
Source code in vedo/pointcloud/reconstruct.py
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 | |
generate_voronoi(padding=0.0, fit=False, method='vtk')
Generate the 2D Voronoi convex tiling of the input points (z is ignored). The points are assumed to lie in a plane. The output is a Mesh. Each output cell is a convex polygon.
A cell array named "VoronoiID" is added to the output Mesh.
The 2D Voronoi tessellation is a tiling of space, where each Voronoi tile represents the region nearest to one of the input points. Voronoi tessellations are important in computational geometry (and many other fields), and are the dual of Delaunay triangulations.
Thus the triangulation is constructed in the x-y plane, and the z coordinate is ignored (although carried through to the output). If you desire to triangulate in a different plane, you can use fit=True.
A brief summary is as follows. Each (generating) input point is associated with an initial Voronoi tile, which is simply the bounding box of the point set. A locator is then used to identify nearby points: each neighbor in turn generates a clipping line positioned halfway between the generating point and the neighboring point, and orthogonal to the line connecting them. Clips are readily performed by evaluationg the vertices of the convex Voronoi tile as being on either side (inside,outside) of the clip line. If two intersections of the Voronoi tile are found, the portion of the tile "outside" the clip line is discarded, resulting in a new convex, Voronoi tile. As each clip occurs, the Voronoi "Flower" error metric (the union of error spheres) is compared to the extent of the region containing the neighboring clip points. The clip region (along with the points contained in it) is grown by careful expansion (e.g., outward spiraling iterator over all candidate clip points). When the Voronoi Flower is contained within the clip region, the algorithm terminates and the Voronoi tile is output. Once complete, it is possible to construct the Delaunay triangulation from the Voronoi tessellation. Note that topological and geometric information is used to generate a valid triangulation (e.g., merging points and validating topology).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
pts
|
list
|
list of input points. |
required |
padding
|
float
|
padding distance. The default is 0. |
0.0
|
fit
|
bool
|
detect automatically the best fitting plane. The default is False. |
False
|
Examples:
Source code in vedo/pointcloud/reconstruct.py
539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 | |
reconstruct_surface(dims=(100, 100, 100), radius=None, sample_size=None, hole_filling=True, bounds=(), padding=0.05)
Surface reconstruction from a scattered cloud of points.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
dims
|
int
|
number of voxels in x, y and z to control precision. |
(100, 100, 100)
|
radius
|
float
|
radius of influence of each point. Smaller values generally improve performance markedly. Note that after the signed distance function is computed, any voxel taking on the value >= radius is presumed to be "unseen" or uninitialized. |
None
|
sample_size
|
int
|
if normals are not present they will be calculated using this sample size per point. |
None
|
hole_filling
|
bool
|
enables hole filling, this generates separating surfaces between the empty and unseen portions of the volume. |
True
|
bounds
|
list
|
region in space in which to perform the sampling in format (xmin,xmax, ymin,ymax, zim, zmax) |
()
|
padding
|
float
|
increase by this fraction the bounding box |
0.05
|
Examples:
Source code in vedo/pointcloud/reconstruct.py
196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 | |
tovolume(kernel='shepard', radius=None, n=None, bounds=None, null_value=None, dims=(25, 25, 25))
Generate a Volume by interpolating a scalar
or vector field which is only known on a scattered set of points or mesh.
Available interpolation kernels are: shepard, gaussian, or linear.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
kernel
|
str
|
interpolation kernel type [shepard] |
'shepard'
|
radius
|
float
|
radius of the local search |
None
|
n
|
int
|
number of point to use for interpolation |
None
|
bounds
|
list
|
bounding box of the output Volume object |
None
|
dims
|
list
|
dimensions of the output Volume object |
(25, 25, 25)
|
null_value
|
float
|
value to be assigned to invalid points |
None
|
Examples:
Source code in vedo/pointcloud/reconstruct.py
298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 | |
transform
PointTransformMixin
Source code in vedo/pointcloud/transform.py
70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 | |
add_gaussian_noise(sigma=1.0)
Add gaussian noise to point positions. An extra array is added named "GaussianNoise" with the displacements.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
sigma
|
float
|
nr. of standard deviations, expressed in percent of the diagonal size of mesh.
Can also be a list |
1.0
|
Examples:
from vedo import Sphere
Sphere().add_gaussian_noise(1.0).point_size(8).show().close()
Source code in vedo/pointcloud/transform.py
315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 | |
align_to(target, iters=100, rigid=False, invert=False, use_centroids=False)
Aligned to target mesh through the Iterative Closest Point algorithm.
The core of the algorithm is to match each vertex in one surface with the closest surface point on the other, then apply the transformation that modify one surface to best match the other (in the least-square sense).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
rigid
|
bool
|
if True do not allow scaling |
False
|
invert
|
bool
|
if True start by aligning the target to the source but invert the transformation finally. Useful when the target is smaller than the source. |
False
|
use_centroids
|
bool
|
start by matching the centroids of the two objects. |
False
|
Examples:
Source code in vedo/pointcloud/transform.py
71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 | |
align_to_bounding_box(msh, rigid=False)
Align the current object's bounding box to the bounding box of the input object.
Use rigid=True to disable scaling.
Examples:
Source code in vedo/pointcloud/transform.py
118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 | |
align_with_landmarks(source_landmarks, target_landmarks, rigid=False, affine=False, least_squares=False)
Transform mesh orientation and position based on a set of landmarks points. The algorithm finds the best matching of source points to target points in the mean least square sense, in one single step.
If affine is True the x, y and z axes can scale independently but stay collinear.
With least_squares they can vary orientation.
Examples:
Source code in vedo/pointcloud/transform.py
167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 | |
flip_normals()
Flip all normals orientation.
Source code in vedo/pointcloud/transform.py
304 305 306 307 308 309 310 311 312 313 | |
mirror(axis='x', origin=True)
Mirror reflect along one of the cartesian axes
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
axis
|
str
|
axis to use for mirroring, must be set to |
'x'
|
origin
|
list
|
use this point as the origin of the mirroring transformation. |
True
|
Examples:
Source code in vedo/pointcloud/transform.py
269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 | |
normalize()
Scale average size to unit. The scaling is performed around the center of mass.
Source code in vedo/pointcloud/transform.py
256 257 258 259 260 261 262 263 264 265 266 267 | |
project_on_plane(plane='z', point=None, direction=None)
Project the mesh on one of the Cartesian planes.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
plane
|
(str, Plane)
|
if plane is |
'z'
|
point
|
(float, array)
|
if plane is |
None
|
direction
|
array
|
direction of oblique projection |
None
|
Note
Parameters point and direction are only used if the given plane
is an instance of vedo.shapes.Plane. And one of these two params
should be left as None to specify the projection type.
Examples:
s.project_on_plane(plane='z') # project to z-plane
plane = Plane(pos=(4, 8, -4), normal=(-1, 0, 1), s=(5,5))
s.project_on_plane(plane=plane) # orthogonal projection
s.project_on_plane(plane=plane, point=(6, 6, 6)) # perspective projection
s.project_on_plane(plane=plane, direction=(1, 2, -1)) # oblique projection
Examples:
Source code in vedo/pointcloud/transform.py
346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 | |
warp(source, target, sigma=1.0, mode='3d')
"Thin Plate Spline" transformations describe a nonlinear warp transform defined by a set of source and target landmarks. Any point on the mesh close to a source landmark will be moved to a place close to the corresponding target landmark. The points in between are interpolated smoothly using Bookstein's Thin Plate Spline algorithm.
Transformation object can be accessed with mesh.transform.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
sigma
|
float
|
specify the 'stiffness' of the spline. |
1.0
|
mode
|
str
|
set the basis function to either abs(R) (for 3d) or R2LogR (for 2d meshes) |
'3d'
|
Examples:

Source code in vedo/pointcloud/transform.py
431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 | |
procrustes_alignment(sources, rigid=False)
Return an Assembly of aligned source meshes with the Procrustes algorithm.
The output Assembly is normalized in size.
The Procrustes algorithm takes N set of points and aligns them in a least-squares sense
to their mutual mean. The algorithm is iterated until convergence,
as the mean must be recomputed after each alignment.
The set of average points generated by the algorithm can be accessed with
algoutput.info['mean'] as a numpy array.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
rigid
|
bool
if |
required |
Examples:

Source code in vedo/pointcloud/transform.py
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 | |





















