<kintel>
FYI: I've added PCBWay as a print service in OpenSCAD using the 3D Print (F8) function. Since the service description is a downloaded file, this will affect existing installs of OpenSCAD too: An arbitrary (alphabetical?) service will be chosen, until my current PR supporting multiple services lands.
<peepsalot>
TylerTork: the typical workflow is to start with 2d polygon, linear_extrude, then position that in 3d space
<TylerTork>
But if I use the BOSL2 polyhedra library to generate me some polyhedra, I don't get to choose that.
<peepsalot>
TylerTork: ah, you're wanting to extrude a face of a an existing polyhedron? yeah that could prove difficult
<peepsalot>
do you have an example image of what you want to accomplish?
<TylerTork>
I figured out a way, but it seems like the sort of thing there should be a library for,
<TylerTork>
way too many lines of code
<peepsalot>
hmm, not sure what the simplest way to produce that would be, i haven't really used BOSL2 myself
<TylerTork>
I don't insist the library be in BOSL2, that's just the source of the polygons I'm trying to manipulate -- as the example use case you asked for.
<pca006132>
is it something like offset extrude? I think someone mentioned it before but not sure if BOSL2 has it
<TylerTork>
I don't insist it be in BOSL2, I just hoped there was some easier way to do it than what I already figured out.
hisacro has quit [Ping timeout: 276 seconds]
kintel has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
hisacro has joined #openscad
<pca006132>
maybe minkowski
<pca006132>
a thin extrusion, and do minkowski sum with a cone
mmu_man has joined #openscad
<JordanBrown>
Are you talking about this thing that looks like a dish made out of pentagons?
<TylerTork>
yes. That's just an example application. What I want is to take an arbitrary 2D shape not oriented on the XY plane, and extrude it at a right angle to its surface.
<JordanBrown>
Don't have 2D shapes that are not on the XY plane. It's almost a bug that they are allowed.
<JordanBrown>
But you seem to be saying that you know how to make the 2D shape, and you know how to position it in 3-space, but you do not know how to first extrude it and *then* position it. Am I missing something there?
<f0lkert>
InPhase: could you please help me with the camera? we were (quite a while ago) working on the transformation required
<JordanBrown>
I'm also confused about the reference (at 20:02:18 Pacific) to using the BOSL2 polyhedra library to create a polyhedron. By definition, a polyhedron is a 3D shape, not a 2D shape.
<JordanBrown>
Did you really mean a polygon?
<TylerTork>
the polyhedron library, for instance, returns it already as a set of 3d points. So to make this bowl -- I ask for the vnf of a polyhedron. I massage the result to remove faces that are above a certain cutoff height, and now I want to generate inner faces and the connections between them.
<JordanBrown>
Ah, so you do *not* have a 2D object. You have a collection of points.
<JordanBrown>
I take it that that's half of a dodecahedron.
<TylerTork>
Yes, and all over the place in this code, there are collections of points that represent a flat face of a polyhedron.
<TylerTork>
whether regular or not.
<JordanBrown>
You could perhaps translate and rotate them to the XY plane, but then you would have to figure out how to translate and rotate the result back into 3-space.
<TylerTork>
indeed
<JordanBrown>
Though come to think of it, if you could figure out how to translate and rotate them onto the XY plane, simply reversing that transformation would put them back where they were in 3-space.
<TylerTork>
it was in the hope of not having to solve a lot of equations that I asked the question here. I consider it a best practice to use the existing libraries when possible instead of writing pages of code.
<JordanBrown>
I suspect that for the dish in question it's easier to figure out what the angles are for the sides, and then just translate and rotate pentagons into the right places.
<TylerTork>
Yes, but again, that was just one example application, and I was hoping for a generalizable solution. Never mind, it doesn't seem like there's already a library for it.
<JordanBrown>
My 3D trig isn't being good enough for me to figure out what those angles are, though I suspect that a good math person would know off the top of their head.
<JordanBrown>
Yeah, you might ask Adrian. I could maybe figure out the math to transform a floating polygon to the XY plane (and thus to transform it back), but I'd have to think about it for a while.
<JordanBrown>
I bet that it is only a couple of lines, but those couple of lines would need exactly the right math.
<JordanBrown>
The first step would be to realize that you don't have to transform a general polygon. If you take any three points of the polygon, you have a triangle that's coplanar with the polygon and transforming that triangle down to the XY plane will transform the polygon too.
<JordanBrown>
I bet that the next step is to pick one of those points, and translate it to the origin.
<JordanBrown>
Then figure out the two rotations that will lay it flat.
<JordanBrown>
Might be easier to think of as three rotations.
<TylerTork>
thanks for the ideas -- It's bedtime here now.
TylerTork has quit [Quit: Client closed]
<JordanBrown>
One rotation to move the second point to above the X axis, one rotation to bring it down to the X axis, and then a final one to bring the third point down to the XY plane.
<JordanBrown>
Perhaps with a special case for when you find that the second point is directly up the Z axis - which might well be that you don't need the first rotation.
<JordanBrown>
Though, hmm, you need to ensure that you get the correct side up.
JakeSays has joined #openscad
JakeSays_ has quit [Ping timeout: 265 seconds]
JakeSays_ has joined #openscad
JakeSays has quit [Ping timeout: 260 seconds]
little_blossom has quit [Ping timeout: 252 seconds]
little_blossom has joined #openscad
guerd87 has joined #openscad
guerd871 has quit [Read error: Connection reset by peer]
<JordanBrown>
TylerTork - sent you (and Adrian for a cross-check) email with a possible answer.
<JordanBrown>
it's nine lines, but really could be coalesced to fewer.
<JordanBrown>
(nine lines of the actual operation, not counting comments, creating the point list, and drawing some helpful stuff to double-check it.
<JordanBrown>
a)
<JordanBrown>
argh. s/a// :-)
cart_ has joined #openscad
cart_ has quit [Ping timeout: 272 seconds]
cart_ has joined #openscad
cart_ has quit [Ping timeout: 244 seconds]
cart_ has joined #openscad
cart_ has quit [Ping timeout: 246 seconds]
Guest85 has joined #openscad
Transatlantic has joined #openscad
<Transatlantic>
Being french, I didn't understand "PM". Now I do. Thanks for the tip :)
cart_ has joined #openscad
cart_ has quit [Remote host closed the connection]
cart_ has joined #openscad
cart_ has quit [Ping timeout: 255 seconds]
Guest71 has joined #openscad
Guest71 has quit [Quit: Client closed]
Guest85 has quit [Quit: Client closed]
J24k24 has quit [Quit: Client closed]
J24k24 has joined #openscad
J24k24 has quit [Quit: Client closed]
J24k24 has joined #openscad
Transatlantic has quit [Ping timeout: 256 seconds]
<InPhase>
f0lkert: I'm getting ready for work at the moment, but sure, if you let me know where you're at and what the current problems are. If it's a larger problem I might not get to it until the weekend.
snaked has quit [Remote host closed the connection]
Smeef has quit [Read error: Connection reset by peer]
<f0lkert>
InPhase: well the good news is that I've got it working. With voodoo-coding though :) ("I wonder what happens if I multiply this with 2" and other trial & error) So now the viewport and povray camera should match.
<InPhase>
f0lkert: *chuckle* Nothing wrong with a little trial and error, as long as you follow it up with some diverse testing examples to make sure it holds. :)
<InPhase>
If you test an angle calculation with a few different random angles across a wide range and across the various axes involved and it continues to hold up accurately, then you would typically have to be struct by lightning from an angry math deity for the calculation to be wrong.
<InPhase>
Just make sure to include small, large, negative, angles with irrational values, and various angle combinations between the axes.
<f0lkert>
well what I eventually did was directly use the pitch/yaw+180/roll for the rotate<x,y,z> in povray. the voodoo is in that I had the multiply the viewer-distance-vector by 2, and negate all the zs of each polygon-point.
<InPhase>
i.e., don't test just the trivial angles like 0, 30, 45, 60, 90, but things like 1, 23, 73, 89
<InPhase>
But also including 0 and 90 can be important sometimes, as you can get singularities on those in some equations.
<f0lkert>
luckily the new code introduces no new calculations for myself, apart from the adding 180 to the yaw.
<InPhase>
That was a need to negate the z's before passing things through that matrix I gave you?
<f0lkert>
no, i actually don't need to use that matrix at all: I just put the camera at <0, 0, dinstance * 2> and then rotate according to p/y/r
<f0lkert>
I suddenly realised (today) that povray can do those calculations itself
<InPhase>
Well, no idea then what the 2 is for, but if it works, it works. There must be some differences in convention involved.
<f0lkert>
the two is the voodoo-part. if not applied then the camera is too close
guso10 has quit [Quit: Client closed]
<teepee>
guso78: so the build process was "easy"?
mmu_man has quit [Ping timeout: 252 seconds]
mmu_man has joined #openscad
<JordanBrown>
Transatlantic Assuming that you mean "pm" as in pca006132's message to me, it meant "private message". With respect to politics... mostly I try to bury my head in the sand and ignore it.
<InPhase>
f0lkert: It must involve some difference in how distance is defined or used for povray, but it could take work to dig such a thing out of documentation if it even exists in documentation. I'm comfortable accepting a successful result for this purpose.
<InPhase>
f0lkert: If you were a grad student working on a research project, I'd instruct you to deep dive and understand it. ;) But this is a pretty picture, and so if you have them matching how they are supposed to look, you have been successful!
<f0lkert>
haha ok :) I'm an old fart, messing with this in my spare time
<f0lkert>
it bothers me though, that multiply
<f0lkert>
maybe i'll figure out why it is required
<InPhase>
f0lkert: Ideas popped into my head about it being something like a halfway point focal distance for a projected image instead of a camera distance, or something wonky like that, but a quick google search didn't find anything on those terms.
<InPhase>
f0lkert: There are plenty of ways it could be a definitional choice issue.
<InPhase>
Or maybe there's a FOV difference causing this problem.
<InPhase>
Distance combined with FOV creates the actual amount captured by the image.
<InPhase>
It might be that the (configurable) FOV you are using in the rest of OpenSCAD, and the default (or configured) FOV for povray, are just the right amount different that a factor of 2 gives you the correct result? If this is the case, it might be worth understanding, precisely because FOV is configurable in OpenSCAD.
<InPhase>
So perhaps you want to change FOV in the OpenSCAD settings and rerun your comparisons?
<InPhase>
I don't know the full picture of what you're doing, or how you compared things, so that suggestion is based on my imagination of what I think you probably did. But an option to consider.
<f0lkert>
yeah, going to see what happens if I double it and remove the *2
<f0lkert>
currently I'm using "angle 22.5" in povray as that's what's in the Camera-structure. maybe that is half of what povray expects?
<InPhase>
If you can find the povray FOV, then some trig math could be done between these two values.
<f0lkert>
povray fov is configurable, that's the 'angle' element in the camera definition
<InPhase>
It's going to be... A ratio of the sin of the two angles?
<InPhase>
I think.
<f0lkert>
well setting the distance to what is in the ui and the angle *2 "looks good" :-)
<f0lkert>
one sec
<InPhase>
teepee: Uhm, where exactly does FOV get set in OpenSCAD?
<f0lkert>
ok I'll look later at it. currently debugging homeassistant @ hackerspace.
<InPhase>
I see fov reported as 22.5 at the bottom.
<f0lkert>
yes, that's the one I used in my pov output (if that's configured at it)
<InPhase>
Now there's also a possibility that one of OpenSCAD or povray made an unconventional choice of defining FOV as angle outward from the fixation point, rather than the traditional sweeping angle from edge to edge. That would introduce a factor of 2 difference.
<InPhase>
If you needed to double the povray distance to get the same, that would indicate OpenSCAD has made the unconventional choice here, if this is the explanation.
<InPhase>
And it would mean our true FOV is 45 and not 22.5
<InPhase>
Which... is possible. I don't usually use perspective mode, preferring orthogonal, but that angle tilt on cube edges looks a little sharp to me for a FOV of 22.5 edge to edge.
<InPhase>
teepee: Hmph... I found FOV in Viewport Control, so nevermind the original question. Then I pulled up Viewport Control, and got default populated values of 0 distance and 0 FOV which seemed concerning. I tried to edit the FOV of 0 and OpenSCAD went to 240% cpu and froze... I think this new Viewport Control might be a bit buggy.
<InPhase>
teepee: I need to get back to my work, and was just embracing a brief diversion. But curious if you are aware of a known issue with this.
<InPhase>
I can try to document later if this is unknown, or if no one beats me to it. Although I didn't really do anything particularly complicated. Opened it, saw zeros, tried to change a value, and the first keypress spiked it hard.
<InPhase>
I can certainly imagine zeros for this sending some math into nan land. But if so we should actively prevent that viewport control from having and/or propagating such values. Not sure where it picked up those default zeros from.
mmu_man has quit [Ping timeout: 248 seconds]
<teepee>
InPhase: yes, there's a lockup bug for some time. I thought I fixed that when changing the layouting of the dock-windows, but it's still happening
<InPhase>
Cool. Well, not cool, but good that it's known. :)
<InPhase>
f0lkert: That "right_length" you use... Is that the bounding box diagonal?
<guso78>
Working again 🤣
<InPhase>
f0lkert: Because the OpenSCAD code is using half of the bounding box diagonal in this calculation.
<InPhase>
f0lkert: See Camera.cc line 63: double bboxRadius = bbox.diagonal().norm() / 2;
<f0lkert>
InPhase: no ignore that angle=... thing, that's a wronge paste
<InPhase>
Oh.
<guso78>
Teepee this stepcode does Not want to be a git submodule 😜
<guso78>
But there IS another integral option
<teepee>
I don't like git submodules for really external stuff anyway
<teepee>
it's just not a stable solution for building
<robsbots>
Hey all. I have a programming question for OpenSCAD. Which would be the best forum to get some help. Thanks.
<peepsalot>
ask away
<peepsalot>
asking here is fine. the mailing list also works
<robsbots>
I want to create a module that will produce a grid of parts X wide, by Y tall with S spacing. I would like to pass it another module for the actual part.
<f0lkert>
InPhase: I may have made a mistake indeed
<f0lkert>
InPhase: will re-render things
<InPhase>
robsbots: Passing modules is not supported yet, but an area that some dev work has happened on so far.
<InPhase>
robsbots: But you can still achieve the goal, just in the other direction, looping over your grid and creating the objects.
<InPhase>
robsbots: Unless you meant all objects in the grid are identical geometries! If that's what you meant, then peepsalot interpreted your comment correctly.
<robsbots>
I need to look up children I think. That could be the key until passing modules is available. Thanks.
<robsbots>
I was assuming that was pseudo code but it is actual code. Wow. That's a massive tool in the toolbox. Thanks very much. That's gonna change how I think in OpenSCAD.
<InPhase>
robsbots: Also, if you are wanting to change elements based on their grid position, it IS actually possible, it's just a little bit trickier to think about than passing modules would be. Here's an example doing so: https://bpa.st/Z3SA2
<InPhase>
Basically you can pass in an index, and you can provide (through various means) a pregenerated list of values to index, and then use those selected values as how you'll modify each element in the grid.
<InPhase>
And it gets sort of unintuitively passed down into the children.
SamantazFox_ has quit [Remote host closed the connection]
mmu_man has joined #openscad
Junxter has joined #openscad
guso17 has joined #openscad
guso17 has quit [Quit: Client closed]
MatrixBot12 has quit [Quit: Bridge terminating on SIGTERM]