Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

scaling an extrusion #69

Open
jkbgbr opened this issue Feb 11, 2020 · 6 comments
Open

scaling an extrusion #69

jkbgbr opened this issue Feb 11, 2020 · 6 comments

Comments

@jkbgbr
Copy link

jkbgbr commented Feb 11, 2020

In the classic vpython a linear scaling of a extrusion was possible by defining a ratio between the start and the end face. In the new version this is not possible; calling extrusion() with a scale argument does not raise a NotImplementedError or similar, but the resulting object is generated as if scale=1 was defined.
Is it planned to incluse this feature?

@mwcraig
Copy link
Contributor

mwcraig commented Feb 11, 2020

Thanks for pointing this out. We'll discuss how to handle this, but pull requests are always welcome 😀.

At a minimum we should raise a NotImplementedError.

@BruceSherwood
Copy link
Member

There are several features of the Classic VPython extrusion object that have not yet been implemented in Vpython 7, and we would welcome someone contributing to finishing the job. Here is the old documentation: https://vpython.org/contents/docs/extrusion.html. Note that scale did not define a ratio between the start and end faces. Rather it scaled the cross section. You can scale the "ratio between the start and end face" by changing the size attribute of the extrusion.

@jkbgbr
Copy link
Author

jkbgbr commented Feb 12, 2020

As I understood size can be used for uniform scaling. I needed the extrusion to be a cone (frustrum) instead of a cylinder.
I''ll look into a possible pull request later this week.

@jkbgbr
Copy link
Author

jkbgbr commented Mar 16, 2020

Hi Bruce, Matt,

can you guide me a little at fixing this? Which module/class is to be modified etc. it would make finding the entry point for the necessary modifications easier.

@BruceSherwood
Copy link
Member

The key file is https://github.com/vpython/glowscript/tree/master/lib/glow/extrude.js, which contains the extrusion function at line 524 (it also contains most of the 3D text machinery, though the text function is in primitives.js). Note that if scale/xscale/yscale varies along the path, the normals to the quads that make up the sides of the extrusion need to be perpendicular to those sides, not to the path.

@jkbgbr
Copy link
Author

jkbgbr commented Mar 17, 2020

I hoped it would be in the python part... unfortunately I have no affinity to js whatsoever - sorry, I can't help in this matter. Will probably implement a pure python cone using triangles only.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants