Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Options
Go to last post Go to first unread
Offline Razonar  
#1 Posted : 19 December 2020 07:42:06(UTC)
Razonar


Rank: Advanced Member

Groups: Registered
Joined: 28/08/2014(UTC)
Posts: 987
Uruguay

Was thanked: 542 time(s) in 352 post(s)
Hi. The attached use the primitives polygon and polyline for show a 3D mesh into a XY plot component. The code is short, and probably have a lot of issues. But ... the code is short.

pMesh.sm (245kb) downloaded 190 time(s).

pMesh.pdf (3,117kb) downloaded 200 time(s).

Best regards.
Alvaro.
thanks 2 users thanked Razonar for this useful post.
on 19/12/2020(UTC),  on 19/12/2020(UTC)
Offline uni  
#2 Posted : 19 December 2020 11:28:05(UTC)
uni


Rank: Advanced Member

Groups: Registered, Advanced Member
Joined: 10/11/2010(UTC)
Posts: 1,317
Man
Russian Federation

Was thanked: 1151 time(s) in 664 post(s)
This is cool.

Perhaps you have enough desire to try to implement this algorithm (Ray Marching).
It would be possible to create a plugin based on this way of displaying bodies in space.

Edited by user 19 December 2020 11:34:44(UTC)  | Reason: Not specified

Russia ☭ forever
Viacheslav N. Mezentsev
Offline Razonar  
#3 Posted : 19 December 2020 22:20:18(UTC)
Razonar


Rank: Advanced Member

Groups: Registered
Joined: 28/08/2014(UTC)
Posts: 987
Uruguay

Was thanked: 542 time(s) in 352 post(s)
Originally Posted by: uni Go to Quoted Post
This is cool.

Perhaps you have enough desire to try to implement this algorithm (Ray Marching).
It would be possible to create a plugin based on this way of displaying bodies in space.


Let me see what I can do

Meanwhile I leave you these comments.

pMesh(1) gives the same answer than yours Createmesh. You can easily modify your code for adapt it as a new other function, maybe XYPlotShow or something else, identifiying the loops. There are the same, I check your Createmesh long time ago. Array S stores “polygon” or “polyline” if the colormap for surfaces is zero, and L stores “polylines” always, and are not filled like the polygons never. Thus, L are in the beginning, and what I see is that you need only let S as it is, or reversing it. My guess is that we only need to take the distances from some “ViewPoint”, not only two angles, but cannot found it. Also, notice that I take the bottom of each polygon for the colormap, and nothing else like averages. This way maybe is not the correct, but it is very fast, assigning before the main loops a complete array of color indices. Wolfram Mathematica use a 3D point as the view point as option, and maybe that’s more correct.

01.gif

pSurf(3): This other could be interesting too, even I don’t show how to use because don’t test it too much (well, nothing). First two are for mapcolored “vf” vector field, “ip” implicit plots, but third option, when isn’t an string first parameter, for take P = pShow(8) and rotate by R and translate by T.

02.gif

By this way you can plot the surface with some (az,el) and then replot for (90 deg, 0 deg), rotate and put down, like matlab surfc. Notice that the last parameter for pShow(8) is for which axis is the colormap, d=3 is the default for z=col(mesh,3). This is the output of matlab surfc:

03.gif

About other graphing options, my opinion is that MSChart component could be very important because they could export to Excel, if not easy, at least you ensure that. I attach my Mathcad 11 mschart component. It is implemented as a general ActiveX component in Mathcad. If you edit it’s code, you can see that the important code is:

ExecuteGlobal str + "End With"

MicrosoftGraphComponent.pdf (592kb) downloaded 27 time(s).

This technique is based in this other files:

VBS.pdf (342kb) downloaded 16 time(s).
Documenting Components.pdf (499kb) downloaded 15 time(s).

Those files was published in the Mathcad advisor newsletter or something like that.
Backing to the mschart, if you now double click on it, you get the Microsoft environment for modify the plot, even it’s not saved you can found the way to get it. Look at the toolbars, are from Microsoft, not Mathcad. At the bottom you have also the sahpes toolbar!

04.gif

There are too many functions and they make it difficult to find functions in the SMath insert functions dialog. I think you should implement it as a single dislin function (str, a, b, c, ...) where str is the dislin instruction and the rest the arguments for that instruction.
You shouldn't let the user have to choose a file name and location to later display the graph in the image component. You can take the component directory, as you do in other plugins, or the temporary one in windows and make, for example, dislin ("disfin", 0) return the name of the file you have generated, with the full path, to insert it as final part of the component.

But the biggest problem with dislin is this other:

05.gif


My recommendation is that if you do that for other software (my recommendation is gnuplot, which was already highly commented on in this forum) you would already have the complete graphics package.
The other option is that instead of integrating a function gnuplot (string, a, b, c, ...) and that has as its starting point gnuplot ("start", "figure_name"Wink the end of the code gnuplot ("end", " figure_name "Wink and the latter returns in full path to be the argument of the image component, create a text region and follow the same philosophy as the mathcad component scripts.
Finally, it would be interesting if some of your components had some instruction similar to matlab's ginput. Besides a lot of games, like lunar landing, other things could be done:

unplot_manual_interpolation.pdf (539kb) downloaded 20 time(s).

Mathcad 11 files:

mcad_files.zip (986kb) downloaded 18 time(s).

Best regards.
Alvaro.

Edited by user 19 December 2020 22:23:22(UTC)  | Reason: Not specified

Offline uni  
#4 Posted : 19 December 2020 23:10:33(UTC)
uni


Rank: Advanced Member

Groups: Registered, Advanced Member
Joined: 10/11/2010(UTC)
Posts: 1,317
Man
Russian Federation

Was thanked: 1151 time(s) in 664 post(s)
I have connected many different libraries to the program as plugins. One of the goals was to show how this can be done. Each method has its own pros and cons. The first external symbolic plugin was the Maple Wrapper. It was an experimental method, but thanks to it, a way to connect Maxima appeared. In this sense, it doesn't matter how popular a particular tool is. What matters is the way in which it can be connected. I hope that in the future it will be easier for programmers if they have a choice of which method to use.
I collect not only libraries, but also ways to connect them. Unfortunately, many of these methods are complex.
We still don't have a video tutorial on how to create complex plugins. Probably things would have gone faster if we had such examples. I don't speak English enough to tell how it's done.

Your examples are interesting enough, but modern visualization tools should be able to do all this and do it much faster.

To connect the MS Chart component, I used a not very good trick. One of the disadvantages of this method is that the image is rasterized, not vector. This component cannot be used on any other OS. In my opinion, we need to pay more attention to the components for which there are source codes, improving them. Documents that use such components will be more versatile.

Edited by user 19 December 2020 23:12:36(UTC)  | Reason: Not specified

Russia ☭ forever
Viacheslav N. Mezentsev
thanks 1 user thanked uni for this useful post.
on 19/12/2020(UTC)
Offline Razonar  
#5 Posted : 19 December 2020 23:38:43(UTC)
Razonar


Rank: Advanced Member

Groups: Registered
Joined: 28/08/2014(UTC)
Posts: 987
Uruguay

Was thanked: 542 time(s) in 352 post(s)
Originally Posted by: uni Go to Quoted Post
I have connected many different libraries to the program as plugins. One of the goals was to show how this can be done. Each method has its own pros and cons.


Yes, you're right, you show how to do that in a amazing number of ways.

Originally Posted by: uni Go to Quoted Post
...
The first external symbolic plugin was the Maple Wrapper. It was an experimental method, but thanks to it, a way to connect Maxima appeared.


I know that. I'm the guy that suggest you to not use the Mathcad Maple's release MapleVR4 but MapleVR5 because the strings identifier.

Originally Posted by: uni Go to Quoted Post
...
In this sense, it doesn't matter how popular a particular tool is. What matters is the way in which it can be connected.


I make this observation because precisely this point

Originally Posted by: uni Go to Quoted Post
In my opinion, we need to pay more attention to the components for which there are source codes, improving them. Documents that use such components will be more versatile.


gnuplot not only have free source code, but also have a lot of examples about how to implement it, and I assume by different methods. Is in that sense that I prefer "popular" apps, not other.

Originally Posted by: uni Go to Quoted Post
To connect the MS Chart component, I used a not very good trick.


It's time for SMath to have OLE or ActiveX services or whatever is used with C sharp

Originally Posted by: uni Go to Quoted Post
...
We still don't have a video tutorial on how to create complex plugins. Probably things would have gone faster if we had such examples. I don't speak English enough to tell how it's done.


Me less! But we have the automatics translation as subtitles from youtube.

Best regards.
Alvaro.
Offline Jean Giraud  
#6 Posted : 20 December 2020 04:12:41(UTC)
Jean Giraud

Rank: Guest

Groups: Registered
Joined: 04/07/2015(UTC)
Posts: 6,099
Canada

Was thanked: 891 time(s) in 719 post(s)
Users browsing this topic
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.