Prev: how to represent a multivariable symbolic expression with missing
Next: Print curly braces in plot
From: vick Audi on 23 May 2010 23:48 Dear All, I have a relatively simple problem I'm struggling with. I want to render color to a 3D line (i.e. a bunch of 3D points connected by a line - please refer to the end of this post for the eg.). Now I'm trying to give each line segment connecting consecutive 3D points a color based on their gradient (finally the line should have R,G,B or anything color in between based on the direction of the gradient vector) i would appreciate any insight with this regards, and any pointers you may know. Thanks, - Vick ************************ >> plot3(points(:,1),points(:,2),points(:,3)); % To visualize the following set of points. points= 50.0000 155.0000 10.0000 50.2000 155.0000 10.0000 50.4000 155.0000 10.0000 50.6000 155.0000 10.0000 50.8000 155.0000 10.0000 51.0000 155.0000 10.0000 51.1404 154.8612 10.0321 51.2808 154.7225 10.0642 51.4212 154.5837 10.0964 51.5616 154.4449 10.1285 51.7020 154.3062 10.1606 51.8424 154.1674 10.1927 51.9829 154.0287 10.2249 52.1233 153.8899 10.2570 52.2637 153.7511 10.2891 52.4041 153.6124 10.3212 52.5445 153.4736 10.3534 52.6849 153.3348 10.3855 52.8253 153.1961 10.4176 52.9657 153.0573 10.4497 53.1061 152.9185 10.4819 53.1061 152.7186 10.4819 53.1061 152.5186 10.4819 53.1061 152.3186 10.4819 53.1061 152.1186 10.4819 53.1061 151.9186 10.4819 53.1061 151.7186 10.4819 53.1061 151.5186 10.4819 53.1061 151.3186 10.4819 53.1061 151.1186 10.4819 53.1061 150.9186 10.4819 53.1061 150.7186 10.4819 53.1061 150.5186 10.4819 53.1061 150.3186 10.4819 53.1061 150.1186 10.4819 53.1061 149.9186 10.4819 53.1587 149.7284 10.4494 53.2113 149.5382 10.4169 53.2638 149.3479 10.3844 53.3164 149.1577 10.3519 53.3690 148.9675 10.3194 53.4210 148.7950 10.2326 53.4729 148.6225 10.1459 53.5249 148.4499 10.0591 53.5769 148.2774 9.9723
From: Walter Roberson on 24 May 2010 00:56 vick Audi wrote: > I want > to render color to a 3D line (i.e. a bunch of 3D points connected by a > line - please refer to the end of this post for the eg.). Now I'm trying > to give each line segment connecting consecutive 3D points a color based > on their gradient (finally the line should have R,G,B or anything color > in between based on the direction of the gradient vector) >>> plot3(points(:,1),points(:,2),points(:,3)); % To visualize the >>> following set of points. Explicitly create your axes with AxesHandle = axes() Set the ColorOrder property of AxesHandle to an N x 3 matrix of RGB values, one for each of the line segments (i.e., N >= size(points,1)-1). Now, plot3(AxesHandle, ... [points(1:end-1,1),points(2:end,1)], ... [points(1:end-1,2),points(2:end,2)], ... [points(1:end-1,3),points(2:end,3)]); The lines will be colored according to the color you indicated in the ColorOrder . Note: there is a possibility that you might have to add hold on before the plot3() call.
|
Pages: 1 Prev: how to represent a multivariable symbolic expression with missing Next: Print curly braces in plot |