Andrew Marsh Polyhedra Generator

156 views
Skip to first unread message

Wagyx Xygaw

unread,
Apr 2, 2023, 4:39:01 AM4/2/23
to antiprism
Hello everyone,

An online viewer and editor I have found last year, pretty neat !

Here is the blog entry : http://andrewmarsh.com/software/poly3d-web/

Wagyx

Ashok Mathur

unread,
Apr 2, 2023, 6:48:14 AM4/2/23
to anti...@googlegroups.com
Wow!
Pretty neat.
--
Antiprism Site: http://www.antiprism.com
---
You received this message because you are subscribed to the Google Groups "antiprism" group.
To unsubscribe from this group and stop receiving emails from it, send an email to antiprism+...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/antiprism/28eae68f-322b-4752-ac06-2630a72ed5c9n%40googlegroups.com.

Roger Kaufman

unread,
Apr 2, 2023, 2:43:54 PM4/2/23
to anti...@googlegroups.com
Hi Wagyx
This viewer shows edges an alternative way as thin black edges. I've
seen this in vrml and I had found another page (screenshot attached)
that did it this way.

In your viewer...

Edge cylinder and vertex ball ratio... In Antiview, if only vertex size
is specified, edge cylinder radius is: vertex_rad/1.5. This ratio seems
to be ascetic.

Initial scale is set by a bounding box of the maximum of
width/length/depth of the model. If the dimensions of the view are known
the initial scale and place any model just inside the window with no
need to zoom.

Will transparent (even with 0 visibility) elements be allowed at some point?

Do models have to closed to work?

Roger
3d_viewer.jpg

Roger Kaufman

unread,
Apr 2, 2023, 2:46:55 PM4/2/23
to anti...@googlegroups.com
Thats a horrible screen shot!

Here it is again not compressed.

Roger
3d_viewer.jpg

Wagyx Xygaw

unread,
Apr 2, 2023, 3:09:50 PM4/2/23
to antiprism
> This viewer shows edges an alternative way as thin black edges. I've
> seen this in vrml and I had found another page (screenshot attached)
> that did it this way.

> In your viewer...

> Edge cylinder and vertex ball ratio... In Antiview, if only vertex size
> is specified, edge cylinder radius is: vertex_rad/1.5. This ratio seems
> to be ascetic.

I can add sliders to control the relative radius of the spheres and the thickness of the cylinders.
Otherwise, I could also go for a wireframe render but that usually does not look good because of the triangulation of the mesh.
There may be some unexpected solution though.

> Initial scale is set by a bounding box of the maximum of
> width/length/depth of the model. If the dimensions of the view are known
> the initial scale and place any model just inside the window with no
> need to zoom.

For the initial scaling, for the moment I scale the model so that the average of the edges length is one.
I agree that it is not optimal but it gives you a good feeling of the acual size of the models
in relation with each other.
If you take a look at my galleries when dozens of polyhedra are displayed at the same time,
I rescale the model to fit whole in the camera field of view.

> Will transparent (even with 0 visibility) elements be allowed at some point?

I will add a slider to handle the transparency level for the faces but it is the same for all.
For the edges and the vertices, you can only set the visibility with the corresponding checkbox.
What do you mean precisely ? Is it like adding an alpha value to the color of a face,
vertex or edges in the OFF file and render properly ?

> Do models have to closed to work?

Models do not need to be closed to work, you can already see that the viewer displays pol3, pol4 and so on fine.
I have made the faces double sided to this end.

Roger Kaufman

unread,
Apr 2, 2023, 7:58:52 PM4/2/23
to anti...@googlegroups.com
Hi Wagyx,

On 4/2/2023 3:09 PM, Wagyx Xygaw wrote:
> I will add a slider to handle the transparency level for the faces but
> it is the same for all.
> For the edges and the vertices, you can only set the visibility with
> the corresponding checkbox.
> What do you mean precisely ? Is it like adding an alpha value to the
> color of a face,
> vertex or edges in the OFF file and render properly ?

I have some models that have semi-transparent faces. The viewer will
show them as solid colors. For example

https://www.interocitors.com/polyhedra/120s/Ivanov_Q5_excavated_by_J92.off

The Sphericon and models generated by n_icons have invisible edges. Even
when the edges are shown, only "path" edges are shown and the rest are
invisible.

For example, the first command paints the edge paths.

n_icons -n 32 -t 8 -e S | antiview -v 0.1

See what the model looks like stripped of all color. There were
invisible edges you see now.

n_icons -n 32 -t 8 -e S | off_util -g | antiview -v 0.1


The viewer shows the edges and vertices are black because the color 0 0
0 0 (black with alpha as 0 is what antiprism interprets as invisible).

https://www.interocitors.com/polyhedra/n_icons/Sphericon/faceted_sphericon.off

Roger

Wagyx Xygaw

unread,
Apr 3, 2023, 5:01:43 PM4/3/23
to anti...@googlegroups.com
Hi there,

I have updated the render and the interface. Is it ok now ? Have I missed anything ?
I can't handle faces with different transparency so I have made a slider to control the transparency globally.
I have hidden the edges that have an alpha of 0.
I have rescaled the models so that they are bounded by the same sphere.

Hope you like it.

--
Antiprism Site:  http://www.antiprism.com
---
You received this message because you are subscribed to a topic in the Google Groups "antiprism" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/antiprism/KVpfpRFNEGE/unsubscribe.
To unsubscribe from this group and all its topics, send an email to antiprism+...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/antiprism/bc0605aa-149e-e213-9316-130f360adceb%40interocitors.com.

Roger Kaufman

unread,
Apr 3, 2023, 7:04:51 PM4/3/23
to anti...@googlegroups.com
Hi Wagxy,

On 4/3/2023 5:01 PM, Wagyx Xygaw wrote:
> Hi there,
>
> I have updated the render and the interface. Is it ok now ? Have I
> missed anything ?
> I can't handle faces with different transparency so I have made a
> slider to control the transparency globally.
> I have hidden the edges that have an alpha of 0.
> I have rescaled the models so that they are bounded by the same sphere.
>
> Hope you like it.

Wow! This is really starting to look good! Models zoomed in
automatically is sweet!

I included some screenshots.

The vertices can also be alpha 0, and when that is so they should be
turned off too.

The edges are always black. But they can also be colored. I like the
black edges (without vertices, I'd could set those off on the command
line) but also have models where colored edges are used. When I used to
program someone would say, "well can't you do it both ways?". Now I'm
the guy asked that lol! This could probably just be done with a line
color override color (to black) check box of some sort, also available
as 'true/false' on the command line.

I can work with that transparency! Again with the black line and
vertices set off which I can set.

Can this be called remotely? That is, can there be a file parameter on
the command line with the url to the off file on another site?

Can there be a download button to the original input? I did this on my
page with this statement. The button class was for the looks of the
button which you may not need. If you do you could just copy the one on
my showoff.html page.

document.write('<a class="button" href="' + getUrlVars()["file"] + '"
download target="_blank"><sup>Download</sup></a>');

Roger
Screenshot (75).png
Screenshot (76).png
Screenshot (77).png

Wagyx Xygaw

unread,
Apr 4, 2023, 6:06:51 PM4/4/23
to antiprism
Hi Roger,
I have implemented all the features you have requested.
However, for the loading of external URLs, I seem to be blocked by the CORS policy

This protection seems to be server based and I don't know if it is something you would have to deactivate on your server if you want to access your files from the application hosted on my website.
You may try it with urls from other website, some may not be protected by this policy or I am doing something wrong, I have no idea.

Please test and let me know what should be fixed or improved.

Wagyx

Roger Kaufman

unread,
Apr 4, 2023, 8:30:09 PM4/4/23
to anti...@googlegroups.com
Hi Wagyx,

Getting better. I struggled with the .htaccess file on my site for about 2 hours and suddenly it started working and I have no idea why. It may be that the cache needed to be cleared on the browser.

I had to add this line in .htaccess in the top directory. It may be more access than is desired but I have nothing but polyhedra on my site at present.

Header set Access-Control-Allow-Origin: *

Let me know if you can see them now.

The download works.

What is the parameter to set the file in the url be since that would be the way I'd have to call the page per off file. I'd probably do this with a re-direct inside the showoff.html page so I don't have to change all my pages.

The vertices are still always black, the "use color" setting could be for both vertices and edges together, they need not be separate.  Picture attached.

Roger
--
Antiprism Site: http://www.antiprism.com
---
You received this message because you are subscribed to the Google Groups "antiprism" group.
To unsubscribe from this group and stop receiving emails from it, send an email to antiprism+...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/antiprism/f9a3d41b-6800-444a-802c-cc04d23dac0fn%40googlegroups.com.

Screenshot (79).png
Message has been deleted

Wagyx Xygaw

unread,
Apr 5, 2023, 5:12:27 PM4/5/23
to anti...@googlegroups.com
Once again, it seems that my message from around 14 hours ago was not sent or is pending.

You received this message because you are subscribed to a topic in the Google Groups "antiprism" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/antiprism/KVpfpRFNEGE/unsubscribe.
To unsubscribe from this group and all its topics, send an email to antiprism+...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/antiprism/e9629c08-4bc3-d6cb-0704-586a3353cb8d%40interocitors.com.

Marcel Tünnissen

unread,
Apr 5, 2023, 5:14:29 PM4/5/23
to anti...@googlegroups.com
Hi Wagyx,

Yes, that is why it is best to provide a Javascript player for
OFF-files as something that is easy to install locally on your own
site.

BR
/Marcel
> --
> Antiprism Site: http://www.antiprism.com
> ---
> You received this message because you are subscribed to the Google Groups "antiprism" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to antiprism+...@googlegroups.com.
> To view this discussion on the web, visit https://groups.google.com/d/msgid/antiprism/f9a3d41b-6800-444a-802c-cc04d23dac0fn%40googlegroups.com.

Roger Kaufman

unread,
Apr 5, 2023, 5:16:52 PM4/5/23
to anti...@googlegroups.com
Sorry about that. There were 3 messages pending. Two were from you and
one was from Marcel. I don't know what is going on but I used the button
to always accept posts from these ids.

Roger

Roger Kaufman

unread,
Apr 5, 2023, 5:29:13 PM4/5/23
to anti...@googlegroups.com
Hi Wagyx,

On 4/5/2023 3:11 AM, Wagyx Xygaw wrote:
> Yes, your change on the CORS setting on your website works for me \o/
> I think you should be a bit more restrictive and allow only off file
> though.

Now I'm afraid of breaking it. I had tried "*.off" but it failed on that
with an error. I had that error for quite a while even when I changed it
back to "*". I had to flush the cache of the browser every time I
altered it.

> The vertex color is fixed.

Yes! How hard would it be to be able to adjust the vertex diameter? The
cylinder size could change along with vertex size. If not, don't worry
about it.

> I have added a url= parameter like so
> https://asliceofcuriosity.pagesperso-orange.fr/blog/extra/polyhedra-viewer-antiprism.html?url=https://www.interocitors.com/polyhedra/108s/108_Rhombohedron_Prolate.off
> it will get URI encoded, you could also directly provide the URI
> encoded string in case you have "weird" characters liying around like
> ? & and = that will mess with the reading of the parameters.
> https://asliceofcuriosity.pagesperso-orange.fr/blog/extra/polyhedra-viewer-antiprism.html?url=https%3A%2F%2Fwww.interocitors.com%2Fpolyhedra%2F108s%2F108_Rhombohedron_Prolate.off

That's great!

>
> I can also make a lighter version of the viewer without the database
> if you want to redirect to it or give you the code for you to set on
> your website.

If it were local, that would probably make it so I didn't need .htaccess
at all. If you were to do that, have you thought about making it a git
project? I'm thinking this is real close to something Marcel could use
as well.

Is it hard to make a windowed version of this with no control panel? I
use Marcel's project for that now and it is for simple viewing. I has
finger tip control for a phone too.

Roger

Wagyx Xygaw

unread,
Apr 6, 2023, 3:50:04 AM4/6/23
to anti...@googlegroups.com
Hi Roger and Marcel.

I have set up a simple version of the viewer on Github.
https://github.com/Wagyx/simple-off-viewer

I have removed most of the features. They can come back though.
You can set the local path to the off file you want as such:
index.html?url=/localpathtofile.off

Tell me if anything is not working here or make the appropriate pull request or ask the question on the Github project directly.

Have a good day

--
Antiprism Site:  http://www.antiprism.com
---
You received this message because you are subscribed to a topic in the Google Groups "antiprism" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/antiprism/KVpfpRFNEGE/unsubscribe.
To unsubscribe from this group and all its topics, send an email to antiprism+...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/antiprism/e6ca72e1-0759-a52e-98d3-08c0c28f31d2%40interocitors.com.

Roger Kaufman

unread,
Apr 6, 2023, 3:01:18 PM4/6/23
to anti...@googlegroups.com
HI Wagyx,

On 4/6/2023 3:49 AM, Wagyx Xygaw wrote:
> Hi Roger and Marcel.
>
> I have set up a simple version of the viewer on Github.
> https://github.com/Wagyx/simple-off-viewer

I pulled that but had quite a few problems. I borrowed the favicon from
your site since that was one error but its more than that.

I think you should determine if the index.html will run in an
environment independent of your site because I'm getting very weird errors.

I tried change some paths in the index.html but wasn't getting anywhere.
The directory hierarchy we should have to run it would really help.

I never thought of this until now, but is there control over the
background color?

> I have removed most of the features. They can come back though.
> You can set the local path to the off file you want as such:
> index.html?url=/localpathtofile.off

I could always just call your site which is working well, but then that
depends on your site being up too, and accessible.

BTW I messed around with .htaccess some more and at one point my whole
site was blocked. So I left it as is for now. Consider that most people
had access to all the files before anyway.

There is no rush on this. The holidays are coming up and starting next
week I will be busy for around 2 weeks. So any changes to my pages will
probably have to wait till May.

Roger

Wagyx Xygaw

unread,
Apr 6, 2023, 4:10:34 PM4/6/23
to anti...@googlegroups.com
Sorry for that, I did it in a rush without so much testing this morning.
I have set the paths to relative to the index page so it should be easier to handle.
If this does not work you should move all the files in some folder and use absolute path starting with / for the css and js files in the html.
you would have to set href="/polyhedra/simple-off-viewer/css/base.css"
don't forget the path to the threejs js file in the import section (line 11)

You could also use the <base> tag in the html header. I have put a commented one in already.

index.html?url=off/U2.off should display the truncated tetrahedron, absolute path would work too like url=/polyhedra/simple-off-viewer/off/U2.off

I have commented the favicon, please use yours instead.

For the different parameters of the app, I try to group them in the gParameters object (line31).
I have added the background color and radius for the spheres and cylinder, just edit the number to what suit your tastes.

This htaccess file seems very tricky indeed.


--
Antiprism Site:  http://www.antiprism.com
---
You received this message because you are subscribed to a topic in the Google Groups "antiprism" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/antiprism/KVpfpRFNEGE/unsubscribe.
To unsubscribe from this group and all its topics, send an email to antiprism+...@googlegroups.com.

Roger Kaufman

unread,
Apr 6, 2023, 8:45:21 PM4/6/23
to anti...@googlegroups.com
Hi Wagyx,

I have to say this is all very nice! Thank you.


On 4/6/2023 4:10 PM, Wagyx Xygaw wrote:
You could also use the <base> tag in the html header. I have put a commented one in already.

All I had to change was base and favicon. For online I shortened the directory name to offview.

https://www.interocitors.com/polyhedra/offview.html
https://www.interocitors.com/polyhedra/offview.html?url=../UCs/off/15__10_Octahedra.off

How do I activate the control panel?


index.html?url=off/U2.off should display the truncated tetrahedron, absolute path would work too like url=/polyhedra/simple-off-viewer/off/U2.off



For the different parameters of the app, I try to group them in the gParameters object (line31).
I have added the background color and radius for the spheres and cylinder, just edit the number to what suit your tastes.

I see these, thanks!


This htaccess file seems very tricky indeed.

Its not well documented.

Roger

Wagyx Xygaw

unread,
Apr 7, 2023, 2:32:14 AM4/7/23
to anti...@googlegroups.com
Wonderful, everything works !
In this version, I have removed the control panel completely and other features too (like the searching and the up/down browsing), do you want it back ? With the same components as before ?
I can add back components for all the fields in gParameters, do you want them as parameters in the url too ?


--
Antiprism Site: http://www.antiprism.com
---
You received this message because you are subscribed to a topic in the Google Groups "antiprism" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/antiprism/KVpfpRFNEGE/unsubscribe.
To unsubscribe from this group and all its topics, send an email to antiprism+...@googlegroups.com.

Roger Kaufman

unread,
Apr 7, 2023, 5:21:00 AM4/7/23
to anti...@googlegroups.com
Hi Wagyx,

On 4/7/2023 2:32 AM, Wagyx Xygaw wrote:
> Wonderful, everything works !
> In this version, I have removed the control panel completely and other
> features too (like the searching and the up/down browsing), do you
> want it back ? With the same components as before ?
> I can add back components for all the fields in gParameters, do you
> want them as parameters in the url too ?

Let's not put the control panel back in the simple viewer. The antiprism
page on your site is there to try those things for now.

Can the simple viewer be able to display more than one model inside a
window? Its probably an html format. For example I have 3 live windows
on this page.

https://www.interocitors.com/polyhedra/n_icons/Sphericon/index.html

When I try to add parameters to the command line they disappear. When I
press enter the transparency parameter is dropped. Is there more I have
to do?

https://www.interocitors.com/polyhedra/offview.html?url=off/U2.off&transparency=0.5

I will have to be able to add parameters to the command line to use the
viewer from my pages.

Roger


Roger Kaufman

unread,
Apr 7, 2023, 10:46:37 AM4/7/23
to anti...@googlegroups.com
Hi Wagyx,

On 4/7/2023 5:20 AM, Roger Kaufman wrote:
> Can the simple viewer be able to display more than one model inside a
> window? Its probably an html format. For example I have 3 live windows
> on this page.

This should have read: more that one model on a page. The "windows" are
canvases I have in side the page.

Here is how I do it now with show-off.

https://www.interocitors.com/polyhedra/js/off_test/index.html

Roger

Roger Kaufman

unread,
Apr 7, 2023, 11:27:27 AM4/7/23
to anti...@googlegroups.com
Sorry, I change the url of the test page

https://www.interocitors.com/polyhedra/showoff/off_test/index.html

Wagyx Xygaw

unread,
Apr 7, 2023, 1:47:31 PM4/7/23
to anti...@googlegroups.com
Hi Roger,

I have updated the viewer on my website with controls for the radius of the spheres and cylinders as well as the background color.
I have updated the simple off viewer git with the handling of url parameters.
If you think that the names of the parameters are too long, I could shorten them.

I'll see what I can do for the canvas. The best would be to be able to do as you do with a single function call that takes the parameters for the render (url, transparency, ...).
On the webpages that display galleries of tens or hundred of polyhedra on my website,
I share the same webgl renderer on multiple scenes that belong to the same canvas where each scene contains a single model.

I guess for now you could use an <iframe> instead.

--
Antiprism Site:  http://www.antiprism.com
---
You received this message because you are subscribed to a topic in the Google Groups "antiprism" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/antiprism/KVpfpRFNEGE/unsubscribe.
To unsubscribe from this group and all its topics, send an email to antiprism+...@googlegroups.com.

Roger Kaufman

unread,
Apr 7, 2023, 2:47:44 PM4/7/23
to anti...@googlegroups.com
Hi Wagyx,

On 4/7/2023 1:47 PM, Wagyx Xygaw wrote:
> I have updated the viewer on my website with controls for the radius
> of the spheres and cylinders as well as the background color.
> I have updated the simple off viewer git with the handling of url
> parameters.
> If you think that the names of the parameters are too long, I could
> shorten them.

I don't think I'll use many parameters at once so hopefully that wont be
a problem. I have a way of generating the tables in my pages with a
spreadsheet. So once that is corrected its just a matter of cut and pasting.

I don't know why parameters are disappearing from the command line. If I
enter this, the transparency parameter disappears. Only the url
parameter remains. So that parameter is being used.

https://www.interocitors.com/polyhedra/offview.html?url=../108s/108_Rhombohedron_Oblate.off&transparency=0.5

> I'll see what I can do for the canvas. The best would be to be able to
> do as you do with a single function call that takes the parameters for
> the render (url, transparency, ...).
> On the webpages that display galleries of tens or hundred of polyhedra
> on my website,
> I share the same webgl renderer on multiple scenes that belong to the
> same canvas where each scene contains a single model.

Thats similar to show-off. One of the problems the show-off javascript
call to draw_shape() had is it couldn't use the base path for some reason.

This morning I was going over some of my pages, changing relative paths
to use the base paths where I could. I did have to lengthen some paths
that way but they are more portable.

Roger

Wagyx Xygaw

unread,
Apr 7, 2023, 2:55:02 PM4/7/23
to anti...@googlegroups.com
Transparency in the url is working fine on my end, have you tried clearing the cache of your browser (Ctrl+F5 or Ctrl+R or both) ?

--
Antiprism Site:  http://www.antiprism.com
---
You received this message because you are subscribed to a topic in the Google Groups "antiprism" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/antiprism/KVpfpRFNEGE/unsubscribe.
To unsubscribe from this group and all its topics, send an email to antiprism+...@googlegroups.com.

Marcel Tünnissen

unread,
Apr 7, 2023, 3:18:12 PM4/7/23
to anti...@googlegroups.com
Thank you, Wagyx.

I haven't had time to look at it yet, but I see a lot is happening.

I will see whether I can find the time later. A small personal preference I have with the viewer I'm wrote myself is the possibility to rotate around the z-axis. You don't need to add that for me though, I'm just informing you about the possibility.

There is an option to implement the control as a ball that you touch and rotate. Then you can imagine if you touch the ball at 6 o clock, then you can spin around the z axis. The disadvantage is that you might not put the ball back in the exact same position if you just touch, rotate a lot and then release at the same position. So in the little browser I made, I did something else. Once again I'm just informing.

Marcel

You received this message because you are subscribed to the Google Groups "antiprism" group.
To unsubscribe from this group and stop receiving emails from it, send an email to antiprism+...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/antiprism/CAGMyLytqd%3DTR68GrOT_N0-bO%2B%3Dyuk-nL4v7VSc40qK1chYJDtA%40mail.gmail.com.

Roger Kaufman

unread,
Apr 7, 2023, 3:21:15 PM4/7/23
to anti...@googlegroups.com
I was only doing Ctrl-F5. It was the cache again.

I like the way all the parameters end up in the url. They are easy to
change.

You have a small info symbol on your page at the bottom left. This would
be useful as info/help.

On your antiprism page help, you tell of the controls for rotate and
zoom. They could also mention fingertip control on touch screens, one
figure rotates, two fingers zoom.

You could have a link in the info/help for the simple viewer to your
antiprism page. If you go to that link, you could open the off file in
your page with the controls (if possible). Then your page would suffice
for controls!

Roger

Wagyx Xygaw

unread,
Apr 7, 2023, 3:32:27 PM4/7/23
to anti...@googlegroups.com
Hi Marcel,
Camera controls are definitively tricky so I won't be implementing any.
I invite you to take a look at the documentation, you may find something that suits your needs there.
Here is the one that I use.
https://threejs.org/docs/index.html?q=controls#examples/en/controls/TrackballControls

Wagyx Xygaw

unread,
Apr 7, 2023, 3:50:59 PM4/7/23
to anti...@googlegroups.com
Hi Roger,
I have just committed the info box.

Wagyx Xygaw

unread,
Apr 7, 2023, 4:56:23 PM4/7/23
to anti...@googlegroups.com
Can I suggest adding some default animation on the model that you could turn on and off with a checkbox ?
It may be a bit ressource intense when displaying multiple polyhedra though.

Roger Kaufman

unread,
Apr 7, 2023, 6:09:20 PM4/7/23
to anti...@googlegroups.com
HI Wagyx,

On 4/7/2023 4:56 PM, Wagyx Xygaw wrote:
> Can I suggest adding some default animation on the model that you
> could turn on and off with a checkbox ?
> It may be a bit ressource intense when displaying multiple polyhedra
> though.

Do you mean that it might turn on its own?

I don't know if you tried this with antiview. Open an off file with
antiview. Press 's' and then spin the model. Now press 'r' and you are
back in regular rotation mode. But the model is still spinning and you
may turn the spinning model with the mouse. So the model can be rotating
on two axes at the same time. You can even turn on the vertex labels and
they will spin with the model but they stay upright.

If a parameter was four parts an for an x,y,z axis if x,y,z,speed was
given, it could be initially spinning. So something like spin=0,1,0,5
would =spin on the Y axis at speed 5.

But you might have something else completely, lol

...

The viewer is looking very nice! Try this.

https://www.interocitors.com/polyhedra/offview.html?url=..%2FUCs%2Foff%2F15__10_Octahedra.off&transparency=0.5&edgesActive=true&facesActive=true&verticesActive=true&useBaseColor=true&vertexRadius=0.02&edgeRadius=0.01&backgroundColor=cccccc

Roger

Roger Kaufman

unread,
Apr 7, 2023, 9:33:16 PM4/7/23
to anti...@googlegroups.com
Hi Wagyx,

On 4/7/2023 1:47 PM, Wagyx Xygaw wrote:
> I guess for now you could use an <iframe> instead.

Using <iframe> I developed a test page for simple-off-viewer embedded test

https://www.interocitors.com/polyhedra/offview/off_test/index.html

One of the things I noticed is that the simple-off-viewer causes a
symmetry viewpoint of the model. This probably isn't always desirable.

I used the earlier simpler index.html without the information button. By
pressing the info button they could start browsing from within the windows!


This page was an alteration of the show-off page. For comparison where
the position of the models is unaltered.

https://www.interocitors.com/polyhedra/showoff/off_test/index.html

Roger

Marcel Tünnissen

unread,
Apr 8, 2023, 3:16:36 AM4/8/23
to anti...@googlegroups.com
Hi Wagyx,

I just cloned your viewer and I have some remarks / questions. They
are related to the fact that I am considering continuing development
on your package.
- It is good to use npm. This way you can include packages that you
aren't maintaining yourself automatically and update them as you see
fit (either updating tem automatically or just by specifying a
specific version). Also there is "npx serve" which starts a webserver
which enables you to test your changes locally quickly. You can also
minimize your package so it loads quicker.
- It is good to add a copyright comment in the beginning of each file
so it is clear which file you copied and which file you wrote yourself
- Are you planning to maintain this in the future? This question is
because I might use this to continue and add on. E.g. I would like to
use a slide bar at some time, like I have on this page
https://tunnissen.eu/polyh/compounds/tetrahedra/index.html#rotational_freedom
for the interactive models.

It seems like we are starting many discussions in one thread, perhaps
we should split the thread, but I am afraid to create too much noise
in the antiprism forum.

Cheers
Marcel
> To view this discussion on the web, visit https://groups.google.com/d/msgid/antiprism/CAGMyLyvhHOWAN0gYV%2BYYD15ag0OXXdDXOyCL8QEdT1M3Ex8z1w%40mail.gmail.com.

Vortex Swirling

unread,
Apr 8, 2023, 12:30:48 PM4/8/23
to anti...@googlegroups.com
Hi Wagyx.

I haven't been able to find the code but apparently you are able to do it. How do you select an off file but get the whole path? Code examples on the web only give me the file name.

Roger

Wagyx Xygaw

unread,
Apr 8, 2023, 12:50:08 PM4/8/23
to anti...@googlegroups.com
Hi Roger, 
I don’t get what you are talking about ? Could you give more explanations on what you are doing please ?
From your site for instance, I copy the link to your off files directly using a right click. 
--
Antiprism Site: http://www.antiprism.com
---
You received this message because you are subscribed to a topic in the Google Groups "antiprism" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/antiprism/KVpfpRFNEGE/unsubscribe.
To unsubscribe from this group and all its topics, send an email to antiprism+...@googlegroups.com.

Roger Kaufman

unread,
Apr 8, 2023, 3:45:54 PM4/8/23
to anti...@googlegroups.com
I'm working with iframe and I have a quick local off file loader. I get
the file name but it wants to put it in the current path of the test
program.

I know I'm not thinking of this correctly because its not like c++
programing.

https://www.interocitors.com/polyhedra/offview/off_test/local_off.html

winview is just a plain call to simple off viewer

https://www.interocitors.com/polyhedra/winview

a quick look at local_off is below

Roger

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Local Off Viewer</title>
  <base href="https://www.interocitors.com/polyhedra/">
</head>


<body>
<div style="width:500px;">
  <h1>Show a Local OFF file </h1>
  <input type="file" id="files" name="files[]" accept=".off" />
  <div style="float:left; width:500px">
    <iframe id="myframe" src="winview.html?url=" width="500"
height="500"></iframe>
  </div>
  <div>
  <script>
    function on_file(evt) {
      var files = evt.target.files;
      document.getElementById("myframe").src = "winview.html?url=" +
files[0].name;
    }
    document.getElementById('files').addEventListener('change',
on_file, false);
  </script>
  </div>
</div>
</body>
</html>

Marcel Tünnissen

unread,
Apr 9, 2023, 2:48:38 AM4/9/23
to anti...@googlegroups.com
H wagyx

Since I didn't get a reply, I forked your repo (as you can see on your
github) and I made some changes.
- First I removed the name Antiprism at some places. Not that I have
anything against Antiprism, but I think the aim should be to support
the OFF file format, not just OFF files as they are generated by
Antiprism. I kept the reference to Antiprism though.
- I started using npm so that three.js can be removed from your repo.
Three.js is maintained somewhere else
- I started to use vite. This makes it easy to try out things. Make
sure to have Node.js installed, run "npm install" and the "npm run
dev". Now you can access the viewer to the address given in the
console. Any changes in the local files will appear directly in the
browser. If you update three.js through "npm install" I think the
server should be restarted. If you run "npm run build" a package is
created in dist. This package can be installed on the web-server.
- I wasn't sure how to remove the jquery stuff. There is something
fishy with jQuery that needs to be defined globally. I checked here:
https://github.com/vitejs/vite/discussions/9415 but I didn't get it to
work
- I added an off file that uses int for the colours. This is
apparently not working yet, but I didn't put any effort into it.

Like I said, I am not sure what your plan for this repo is, but if you
want I can make a pull request.

Cheers
Marcel

Marcel Tünnissen

unread,
Apr 9, 2023, 3:19:56 AM4/9/23
to anti...@googlegroups.com
Hi again,

I just ran a "npm run build". I only ran locally before.
Some more things need to be fixed before doing a pull.

vite v4.2.1 building for production...
<script src="js/jquery-1.9.1.js"> in "/index.html" can't be bundled
without type="module" attribute
<script src="js/jquery-ui.js"> in "/index.html" can't be bundled
without type="module" attribute
<script src="js/info.js"> in "/index.html" can't be bundled without
type="module" attribute
transforming (7) css/base.css
images/animated-overlay.gif referenced in
/home/marceltn/self/fromGitHub/simple-off-viewer/css/jquery-ui.css
didn't resolve at build time, it will remain unchanged to be resolved
at runtime

images/ui-bg_glass_75_e6e6e6_1x400.png referenced in
/home/marceltn/self/fromGitHub/simple-off-viewer/css/jquery-ui.css
didn't resolve at build time, it will remain unchanged to be resolved
at runtime

images/ui-bg_glass_75_dadada_1x400.png referenced in
/home/marceltn/self/fromGitHub/simple-off-viewer/css/jquery-ui.css
didn't resolve at build time, it will remain unchanged to be resolved
at runtime

images/ui-bg_glass_65_ffffff_1x400.png referenced in
/home/marceltn/self/fromGitHub/simple-off-viewer/css/jquery-ui.css
didn't resolve at build time, it will remain unchanged to be resolved
at runtime

images/ui-bg_glass_55_fbf9ee_1x400.png referenced in
/home/marceltn/self/fromGitHub/simple-off-viewer/css/jquery-ui.css
didn't resolve at build time, it will remain unchanged to be resolved
at runtime

images/ui-bg_glass_95_fef1ec_1x400.png referenced in
/home/marceltn/self/fromGitHub/simple-off-viewer/css/jquery-ui.css
didn't resolve at build time, it will remain unchanged to be resolved
at runtime

images/ui-icons_2e83ff_256x240.png referenced in
/home/marceltn/self/fromGitHub/simple-off-viewer/css/jquery-ui.css
didn't resolve at build time, it will remain unchanged to be resolved
at runtime

images/ui-icons_cd0a0a_256x240.png referenced in
/home/marceltn/self/fromGitHub/simple-off-viewer/css/jquery-ui.css
didn't resolve at build time, it will remain unchanged to be resolved
at runtime

images/ui-bg_flat_0_aaaaaa_40x100.png referenced in
/home/marceltn/self/fromGitHub/simple-off-viewer/css/jquery-ui.css
didn't resolve at build time, it will remain unchanged to be resolved
at runtime
"FaceColors" is not exported by
"node_modules/three/build/three.module.js", imported by
"off-file-viewer.js".
✓ 9 modules transformed.

/Marcel

Wagyx Xygaw

unread,
Apr 9, 2023, 4:49:30 AM4/9/23
to anti...@googlegroups.com
Hi Marcel,

I was busy yesterday so I could not answer your message.
I am not using npm because I like to have all my resources stored locally so that when I come back in 10 years,
things are more likely to be still working even though the web environment changes a lot in this time frame.
In a nutshell, I have set a very basic standalone project that should last like the original Stemkovski's projects.
Feel free to extend and improve over it.

To set a web server running locally, I use VSCode Live Server feature which works well or plain old "python -m http.server".
My website is hosted in a way where I don't have access to the server directly, so that's why I have made a full html5, css and js application.
I can only upload my files through ftp. Of course, this is probably not your case.

I agree with removing the Antiprism name as it should work with standard (without faces of length 1 and 2) OFF file.
The issue with integer in color would have to be fixed though, I can do it.

Adding copyrights seem like the right things to do.

I don't know about vite nor node.js so much, I'll take a look.

Happy Easter !



Wagyx Xygaw

unread,
Apr 9, 2023, 5:09:16 AM4/9/23
to anti...@googlegroups.com
Hi Roger,

The url parameter is only for files that are hosted on the internet (or a local web server), you can't use it for a local file on your machine.
The important function is loadFileFromUrl, I have another one for local file which is only triggered through the input button.
That's why I have two different fields on my website viewer, one for local files and one for url files.

Let me see if can work something using a different parameter like ?file=

Happy Easter !

Marcel Tünnissen

unread,
Apr 9, 2023, 5:10:40 AM4/9/23
to anti...@googlegroups.com
Hi Wagyx,

No problem, we are all busy..

I understand your reasoning. The only problem is that you will not
follow the development. If there are any vulnerabilities in the code
you included, these will not be fixed. When you create a bundle, you
can still use that bundle after ten, but of course you cannot do much
development on that. There is always that balancing is doing something
yourself, or using something developed by someone else. What happens
if the totally change their interface or discontinue support? Another
disadvantage is when a library grows really big or gets really many
dependencies. So yes, I understand what you mean. For that reason I
kept my own off-file viewer quite minimal as well.

About the face lengths. I guess faces of length 1 should always be
treated as vertices and faces of length 2 as edges. I assume that a
good default behaviour would be not to draw the implicit edges /
vertices then. Otherwise one could optionally draw the implicit ones
(through some setting)

Cheers
Marcel

/MT

Happy Easter to you too.
> To view this discussion on the web, visit https://groups.google.com/d/msgid/antiprism/CAGMyLyuj9mcTH3tzmin0xw_osFzzUJhWoRCZmum%2BzA0RLR4%2B0Q%40mail.gmail.com.

Adrian Rossiter

unread,
Apr 9, 2023, 5:11:17 AM4/9/23
to anti...@googlegroups.com
Hi Wagyx

On Sun, 9 Apr 2023, Wagyx Xygaw wrote:
> I agree with removing the Antiprism name as it should work with standard
> (without faces of length 1 and 2) OFF file.

OFF faces with 1 and 2 vertices are standard!

Here is a bug report I filed with Meshlab, which errors on these faces

https://sourceforge.net/p/meshlab/bugs/413/

Adrian.
--
Adrian Rossiter
adr...@antiprism.com
http://antiprism.com/adrian

Wagyx Xygaw

unread,
Apr 9, 2023, 9:40:46 AM4/9/23
to anti...@googlegroups.com
Hi Adrian,

Oh the status was set to wont-fix on  2014-11-07, that's bad.
Do you think reopening this issue is worth ?

--
Antiprism Site:  http://www.antiprism.com
---
You received this message because you are subscribed to a topic in the Google Groups "antiprism" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/antiprism/KVpfpRFNEGE/unsubscribe.
To unsubscribe from this group and all its topics, send an email to antiprism+...@googlegroups.com.

Roger Kaufman

unread,
Apr 9, 2023, 10:10:31 AM4/9/23
to anti...@googlegroups.com
Hi Wagyx,

On 4/9/2023 5:09 AM, Wagyx Xygaw wrote:
> The url parameter is only for files that are hosted on the internet
> (or a local web server), you can't use it for a local file on your
> machine.
> The important function is loadFileFromUrl, I have another one for
> local file which is only triggered through the input button.
> That's why I have two different fields on my website viewer, one for
> local files and one for url files.
>
> Let me see if can work something using a different parameter like ?file=
>
> Happy Easter !

On your viewer with the panel, when "choose files" it doesn't care where
my file is. It even works on my phone. Its really putting the file in
cache I'm thinking? If there was a "file=" it would have to have the
full path. From what I am reading, and correct me if I'm wrong, security
fixes in browsers keep it from getting the path. So this isn't a high
priority.

I was also messing around with trying to open the viewer from the
command line. Something like: off_util U1 | off_web.py. It can be done
with python webbrowser.get(browser_path).open(url, new=2). This is quite
avant guard so I wouldn't be surprised if this isn't possible.

Off files with rbg as integers work. I attached an off file that has one
face, one edge, and one vertex as colors using integers. It works in
your viewer and the simple one.

I myself, am very satisified with how the viewer is going now. I liked
the free advertising for Antiprism lol! But I haven't implemented it
except for a test page since its still being produced. Things are
happening quickly but there is no reason to rush and make it so things
can't be changed or fixed easily.

Also Happy Easter!

Roger
test.off

Marcel Tünnissen

unread,
Apr 9, 2023, 10:28:37 AM4/9/23
to anti...@googlegroups.com
I think the problem I had, must have been related to the fact the FaceColors isn't part of a newer version of three.js, that I got, when I removed it from the repo and used the latest version through npm.

Marcel

--
Antiprism Site:  http://www.antiprism.com
---
You received this message because you are subscribed to the Google Groups "antiprism" group.
To unsubscribe from this group and stop receiving emails from it, send an email to antiprism+...@googlegroups.com.

Adrian Rossiter

unread,
Apr 9, 2023, 11:05:48 AM4/9/23
to anti...@googlegroups.com
Hi Wagyx

On Sun, 9 Apr 2023, Wagyx Xygaw wrote:
> Oh the status was set to wont-fix on 2014-11-07, that's bad.
> Do you think reopening this issue is worth ?

I don't use MeshLab or follow the project and so I couldn't say.

Wagyx Xygaw

unread,
Apr 9, 2023, 12:02:07 PM4/9/23
to anti...@googlegroups.com
Hi Roger,

Yes, you are right, the browser security prevents from getting the path to the file but the content is stored in a File Object.
I think it should be possible to dump the object to json, encode it in base64, pass it through the parameters, decode it, turn the json into an object and then pass it to the loadFromFile function.
I have not tried it though.

This python command works but I don't know how you could get the equivalent for a local file.
There may be a way to replicate the object creation that the browser performs with some additional python code when reading a local file and then apply the same process as described above.
Or you could set a python server locally and use the url to pass your file, that should work nicely. You would just have to figure out the correct paths to run the server and get the files.

Thank you for testing the integer rgb colors, it is nice to know that the Three.js Color object handles both float and int data correctly on its constructor.

--
Antiprism Site:  http://www.antiprism.com
---
You received this message because you are subscribed to a topic in the Google Groups "antiprism" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/antiprism/KVpfpRFNEGE/unsubscribe.
To unsubscribe from this group and all its topics, send an email to antiprism+...@googlegroups.com.

Roger Kaufman

unread,
Apr 10, 2023, 4:55:19 AM4/10/23
to anti...@googlegroups.com
Hi Wagyx,

On 4/9/2023 12:01 PM, Wagyx Xygaw wrote:
> Yes, you are right, the browser security prevents from getting the
> path to the file but the content is stored in a File Object.
> I think it should be possible to dump the object to json, encode it in
> base64, pass it through the parameters, decode it, turn the json into
> an object and then pass it to the loadFromFile function.
> I have not tried it though.
>
> This python command works but I don't know how you could get the
> equivalent for a local file.
> python -m webbrowser -t
> "https://asliceofcuriosity.pagesperso-orange.fr/blog/extra/polyhedra-viewer-antiprism.html?url=https://www.interocitors.com/polyhedra/108s/108_Rhombohedron_Prolate.off"
> There may be a way to replicate the object creation that the browser
> performs with some additional python code when reading a local file
> and then apply the same process as described above.
> Or you could set a python server locally and use the url to pass your
> file, that should work nicely. You would just have to figure out the
> correct paths to run the server and get the files.

Chrome has a web server app in their store. (it complains that its no
longer supported but it starts anyway). I couldn't get this working
until I checked Set CORS header. Then I was able to open a local file as

https://www.interocitors.com/polyhedra/offview.html?url=http://127.0.0.1:8887/test.off

test.off was in the top directory which in this case was /Website but it
could have been set as / (root of disk).

This is quite a few hoops to jump through for the user.

Tomorrow I will see if anything could be done with the python command
given this method.

Roger
Screenshot (80).png

Roger Kaufman

unread,
Apr 10, 2023, 11:54:19 AM4/10/23
to anti...@googlegroups.com
Hi Wagyx,

On 4/10/2023 4:55 AM, Roger Kaufman wrote:
> This is quite a few hoops to jump through for the user.

Oh yeah it is.

The http server program is independent of chrome now, still free and is
here. https://simplewebserver.org/

I run the server on a dedicated directory on my d drive as d/webview.
Then none of the rest of my computer is exposed.

Now I can run this python script from the command line and, so far, just
takes one parameter, the off file which is copied to
d/webview/webview.off. The script has potential. It could also take
input from stdin and copy that to webview.off. Potentially it could take
parameters like antiview for everything the simple off viewer will
handle. e.g. -B background color.

A further challenge would be to open an off file from the file manager
and have it call the python script through a Windows batch file. I do
something like this now with antiview to call the cygwin/unix version of
antiview from a batch file.

Unfortunately I'm busy for the two weeks as I'm hosting some guests but
I wanted to get this proof of concept as far as I could before hand.

webview.py below.

Roger

#!/usr/bin/python3

import os
import sys
import webbrowser

os.system("cp '%s' ~/d/webview/webview.off" % (sys.argv[1]))

#url =
'https://asliceofcuriosity.pagesperso-orange.fr/blog/extra/polyhedra-viewer-antiprism.html?url=http://127.0.0.1:8080/webview.off'
url =
'https://www.interocitors.com/polyhedra/offview.html?url=http://127.0.0.1:8080/webview.off'

# Windows chrome
browser_path = 'C:/Program Files (x86)/Google/Chrome/Application/chrome.exe'

webbrowser.register('chrome', None,
webbrowser.BackgroundBrowser(browser_path))
webbrowser.get('chrome').open(url, new=2)

Reply all
Reply to author
Forward
0 new messages