<JordanBrown[m]>
But really it seems like for str(function), echo(function), and AST dump what you really want is to retain the actual text from the program, so that if the program said "2.00" then that's what you emit.
<JordanBrown[m]>
printf that prints a vector of points to a specific precision does not involve Expression.
<JordanBrown[m]>
That's all Value.
<JordanBrown[m]>
I'm pretty sure that CSG dump doesn't involve Expression.
<peepsalot>
JordanBrown[m]: hmm... i was also thinking how to output a function Value, but I suppose it would only make sense to use full precision if the function definition contains number literals
<JordanBrown[m]>
And (a) believing that you can sensibly control the appropriate presentation from above doesn't seem right, and (b) str(function) and echo(function) are really narrow cases.
<JordanBrown[m]>
So is AST dump, for that matter.
<peepsalot>
well, any numeric values of AST and CSG should go through libfmt to guarantee full precision
<JordanBrown[m]>
Yes, but that seems like it could be part of their respective toString implementations.
<peepsalot>
although its more like a toStream operation. currently Expression uses virtual void print(std::ostream& stream, const std::string& indent) const
<JordanBrown[m]>
Yeah, pretty much the same thing though.
<peepsalot>
and I agree with you now, that number formatting indo shouldn't need to be passed down through Expressions, they should just always use full precision
<peepsalot>
... but that indent parameter passing is also basically formatting
<JordanBrown[m]>
yeah, but is it libfmt formatting?
<peepsalot>
well i have been wrestling with how much we want to replace streams with libfmt style
<JordanBrown[m]>
My tentative answer for that is that libfmt is not well suited for pretty printing programs.
<JordanBrown[m]>
And AST dump and str(function) and eventually str(module) are pretty-printing problems.
<JordanBrown[m]>
Whether they should use full precision, shrug. Since I generally have a hard time seeing use cases that aren't purely diagnostic, mostly I don't care. If I ever came up with a case where I would routinely want to see the values, I think I'd want some level of rounding. I don't need to see that 0.1 is really 0.10000000000000001.
<JordanBrown[m]>
Or whatever number it would be, probably with several more digits, to show the full precision.
<JordanBrown[m]>
Feel free to round off the last few bits.
<peepsalot>
idk, pretty-printing is just one particular kind of formatting to me
<JordanBrown[m]>
I would distinguish it in two ways:
<peepsalot>
what particularly makes you think its not well suited?
<JordanBrown[m]>
First, the cases we're talking about here are purely diagnostic. You aren't going to put str(function) into a report.
<JordanBrown[m]>
Second, libfmt seems intended for sprintf type cases, where "values" are all intra-line. Maybe that's just a restrictive viewpoint.
<peepsalot>
i don't really get what you mean by diagnostic, or report
<peepsalot>
in that context
<JordanBrown[m]>
What kind of output is this? Why are you trying to apply formatting to it?
<JordanBrown[m]>
Some people have OpenSCAD programs that emit BOM lists. They want formatting to make those lists neat and easy to read. That's a production use of formatting.
<JordanBrown[m]>
Then there's "somebody called my module and I want to know what arguments they gave it so that I can debug my program", and one of the arguments happens to be a function. That's a diagnostic use.
<JordanBrown[m]>
In a production use I want to control the formatting fairly closely, because I expect to look at the output from many runs, feed it into other documents, et cetera.
<peepsalot>
anywhere that may end up printing a floating point value, i would like to use libfmt for
<JordanBrown[m]>
In a diagnostic use, I'm going to look at it a few times, and then either turn it off or delete it entirely.
<JordanBrown[m]>
Sure, but that doesn't mean that it has to be libfmt all the way up the call stack.
<JordanBrown[m]>
There could be a top-level libfmt call that sees Expression and calls Expression.toString (or a stream equivalent), and somewhere deep below it calls Literal.toString, and Literal.toString calls Value.toString, and Value.toString calls libfmt to format a floating point number.
<JordanBrown[m]>
In such a design, the top-level libfmt call sees the Expression as a string, and the bottom-level call sees only the number. Libfmt never tries to do anything with an Expression per se.
<JordanBrown[m]>
It seems like having libfmt itself try to do anything with the Expression would be a ton of work, for basically zero value.
<InPhase>
peepsalot: My instinct is that expressions are behaviors, and thus polymorphism should be available for use, meaning an inheritance hierarchy.
<InPhase>
peepsalot: There's a broad principle that one should avoid manual type inspection in C++ when polymorphism is available, because polymorphism typically permits centralizing key behavior in the types that require specific knowledge of what to do with themselves. This results in a code structure that is less interdependent and more localized.
<InPhase>
peepsalot: If there is a formatting issue, that can probably also be handled with a virtual function in some manner.
<InPhase>
peepsalot: Perhaps a visitor-like approach is required. "Print yourself to this"
<peepsalot>
like std::visit ? :P
<InPhase>
Doesn't need to be that, as that seems to be targetting variants. :) Just, the general principle of that dispatch pattern.
<peepsalot>
visitor pattern always feels cumbersome to me
<JordanBrown[m]>
We have existing stream<<xxx, xxx.toString, and xxx.print(stream) patterns.
<InPhase>
peepsalot: Basically you want expressions to have the logging equivalent of a Python __str__ method.
<InPhase>
There's a lot of cleanliness in things knowing how they should be represented in formatted text.
<InPhase>
It also makes it very clear that this should be implemented for new expression types added.
<JordanBrown[m]>
InPhase: you do know that we already have exactly that, right? It's perhaps not as consistent as it should be, and probably its floating point support should be implemented atop libfmt, but it's there already.
<InPhase>
Yeah. It just needs to go into libfmt style. peepsalot was asking about changing that structure around.
<InPhase>
I think we're reasonably close to optimal on that particular structure.
<JordanBrown[m]>
There's minor annoying inconsistencies. I believe, for instance, that there are two distinct implementations of toString for functions.
<JordanBrown[m]>
One ends up used in AST dump, while the other is used in str(function).
<InPhase>
There are two?
<JordanBrown[m]>
I think so. Looking.
<InPhase>
I assumed strings would just be an ostream of stringstream.
<InPhase>
Although I'm not sure what a proper restructuring of this should look like for libfmt. I haven't looked closely at that full interface.
<JordanBrown[m]>
I don't know that there's any true duplication, but sometimes the to-sequence-of-characters processing for an object is in one, sometimes in another.
teepee has quit [Ping timeout: 255 seconds]
teepee_ is now known as teepee
<JordanBrown[m]>
I tentatively think that v.print(stream) is the best one to be the "core" - the stream variants seem more flexible than the string variants, and IIRC the .print() variant deals better with polymorphism than the stream << v variant does.
<JordanBrown[m]>
My geometry work may have been something of a special case, in that I had to add both an AST dumper and a CSG dumper and they were very similar. I know that at some points in the process I had written one but not the other.
<JordanBrown[m]>
Or something like that.
<linext>
someone at the local makerspace made a tinkercad tutorial
<linext>
for simplicity, yes, but not for ease of use
<linext>
tinkercad is very easy to use
<linext>
if you don't mind making an autodesk account
EkpyroticFrood has quit [Ping timeout: 260 seconds]
<InPhase>
linext: Does your site not have fastcsg?
<InPhase>
linext: Context: I was bothered by the likelihood that the ring holder will snap off of your design, so I nerd sniped myself into making this version: https://www.3dcustomizer.net/paste/34AE92D5
<InPhase>
linext: However rather than the 1 second render I get locally, it's 160 seconds.
<InPhase>
linext: Nerd sniping because I obsessed too much about smoothing out the alignment of all the edges and surfaces on that.
<InPhase>
linext: Oh, and I redid the text metrics scaling, because my name has a y in it, and this requires special treatment...
<InPhase>
JordanBrown[m]: Thanks for adding just enough info that the y offsets can be accounted for properly. :)
<JordanBrown[m]>
I gave you everything I could find…
ur5us has quit [Ping timeout: 255 seconds]
_whitelogger has joined #openscad
RichardP_ has quit [Read error: Connection reset by peer]
RichardPotthoff has joined #openscad
aiyion has quit [Ping timeout: 255 seconds]
fling_ has joined #openscad
fling has quit [Remote host closed the connection]
aiyion has joined #openscad
fling_ is now known as fling
guso78 has joined #openscad
guso78 has quit [Client Quit]
ur5us has joined #openscad
ur5us has quit [Ping timeout: 248 seconds]
aiyion has quit [Ping timeout: 255 seconds]
aiyion has joined #openscad
teepee_ has joined #openscad
teepee has quit [Ping timeout: 255 seconds]
teepee_ is now known as teepee
castaway has joined #openscad
use-value has joined #openscad
use-value has quit [Read error: Connection reset by peer]
use-value has joined #openscad
<J235041>
InPhase .. render need 180s in WASM while just 1sec in the program
teepee has quit [Ping timeout: 255 seconds]
teepee has joined #openscad
fling has quit [Remote host closed the connection]
<guso78>
ctest have failed with my PR. maybe offset on a 3D object gave an unexpected result, but I don't know
<Scopeuk>
all the tests that failed are offset tests, is it possible that your 3d offset "stole" the 2d offset behaviour?
<guso78>
haha, let me check, it was working some time before ...
<Scopeuk>
I need to wait for the run to finish before I can take a look at the results it appears
<guso78>
nope ... i believe 2d is still working IMHO( this was actually a design feature to keep it intact ...)
<Scopeuk>
it looks like the 3d tests just didn't produce an image in the results report
<guso78>
ok. but right now i just know how this did happen
<Scopeuk>
yeh exe bombed out Error: openscad failed with return code -11
<Scopeuk>
that I'm not sure on
<guso78>
ahh segfault
<Scopeuk>
maybe try running the test locally with your build?
<guso78>
locally they run fine
<guso78>
actually i was not completely sure if i did correct with all this std::shared_vector.
<guso78>
A code review here would be very helpful
<Scopeuk>
yeh windows failed the same way Error: openscad.com failed with return code 3221225477 which is 0xC0000005 illegal memory access
<guso78>
sorry std::shared_ptr
snaked has quit [Ping timeout: 252 seconds]
<guso78>
yep, found something odd. trying better
TheAssassin has quit [Quit: No Ping reply in 180 seconds.]
<Scopeuk>
standard point here of either chase through all your painters, array bounds/map bounds (although maps tend to help themselfs to more ram and produce nonsense) or throw it as a debugger and stacktrace where it is when it crashes
TheAssassin has joined #openscad
<guso78>
yes, i am aware that there is std::map_unordered, but i really need it.
<Scopeuk>
std::map shouldn't cause illegal memory access, accesing an invalidkey causes the key to come into existance
<Scopeuk>
it is still strange that we are triggering this during the 2d offset which shouldn't hit any none production code
<Scopeuk>
can anyone remember where the codeql reports end up?
<Scopeuk>
I'm wondering if static analysis found anything here
<guso78>
no there is actually a stupid variable name collision. fixed it now. compiles and looks correct in my place
<guso78>
lets see
<guso78>
Scopeuk, your name implies you are british ?
<guso78>
still would benefit from a code review of the "ptr stuff"
<Scopeuk>
guso78 I am British yes
<Scopeuk>
any particular bit of the pointers, other than there is a raw one in there which is always "fun"
evils[m] has joined #openscad
epony has joined #openscad
<guso78>
when having a password with the IRC user, can you enter the irc chat from different places ?
<guso78>
it appears my fix was effective :)
<Scopeuk>
irc only permits a single user to connect from a single place at a time (if you aren't connected there you can connect from anywhere)
<Scopeuk>
to connect from multiple places you either need a bouncer or some sort of client server based irc client, I use "the lounge" becouse android irc clients are awful, but historically I have also used smuxi (another client server solution) and znc which is a bouncer (it connects to the server and you then connect your client(s) to the bouncer)
use-value has quit [Ping timeout: 252 seconds]
guso7851 has joined #openscad
<guso7851>
thank you for your input
<guso7851>
is it possible to assign a password to my user ?
<guso7851>
all check are clean in the meantime
guso78 has quit [Ping timeout: 260 seconds]
<Scopeuk>
normally one must register with nickserv
<Scopeuk>
type /msg nickserv help to get the instruction from it
guso7851 has quit [Quit: Client closed]
guso78 has joined #openscad
<guso78>
Scopeuk, worked out, thanks
<guso78>
ctest is next for offset
guso7875 has joined #openscad
guso78 has quit [Ping timeout: 260 seconds]
guso7875 has quit [Quit: Client closed]
guso78 has joined #openscad
use-value has joined #openscad
fling has quit [Remote host closed the connection]
fling has joined #openscad
Guest55 has joined #openscad
<guso78>
I still have a hard time to understand , how the files are referenced in test - CMakelists.txt
<guso78>
Where is data/scad/2D/features/offset-tests.scad references e.g. ?
<Scopeuk>
I belive they all start in the tests folder within the git repo
linext has quit [Read error: Connection reset by peer]
<Scopeuk>
which defines a list FEATURES_2D_FILES which is then referenced in various test sets
<Scopeuk>
so to add another test to that set you would just create a scad file in that directory and it would fall out (as far as running is concerned, I'm not completely sure of how the reference images are handled, that bit of the test suite I've not looked at
<guso78>
ahh, unless you understand he concept, it looks little obfuscated at the beginning ....
<Scopeuk>
yeh cmake is a little like make in that regard, you sort of tell it how to do things then leave it to it, rather than telling it what to do
Guest55 has quit [Ping timeout: 260 seconds]
<linext>
i designed a little thumb knub for the leatherman free series
<guso78>
hey, i started to understand the test concept
<guso78>
the 3d offset only works correctly for CGAL(F6) but not for OPENSCG(F5) and not for thrown-together
<guso78>
i believe some other magic needs to be applied in the Renderer to get it correct
<Scopeuk>
yeh the preivew is a completely different system, I'm not sure how the geometry overlap happens for that you need someone who's played with the core, I'm sure teepee will be around later to point out suitable people/example, I think JordanBrown[m] has done some bits with it too but may be mistaken
<guso78>
../../tests/regression/cgalpngtest/offset_tests-expected.png is the only correctly looking picture
RichardPotthoff has quit [Ping timeout: 246 seconds]
paddymahoney has joined #openscad
Lagopus has quit [Remote host closed the connection]
Lagopus has joined #openscad
<JordanBrown[m]>
Scopeuk: guso78 I am a little familiar with the preview system, but not very. There are roughly two classes of things that it handles: things that produce triangles, and booleans that it knows how to handle (union, difference, intersection). If your node produces triangles, it should just work, give or take convexity. But note that to produce triangles it has to fully render everything below it, which can be expensive.
Lagopus has quit [Ping timeout: 248 seconds]
guso7833 has joined #openscad
ur5us has joined #openscad
guso7833 has quit [Ping timeout: 260 seconds]
Guest21 has joined #openscad
<Guest21>
Hello :)
<JordanBrown[m]>
Good {morning, afternoon, evening}.
<Guest21>
I have a question about openscad, am i in the right channel ?
<JordanBrown[m]>
Yep.
<JordanBrown[m]>
Ask away.
<Guest21>
i just discover openscad, i want to know if their is a doc for the source code (description of the class, the structure of the program...) ?
<JordanBrown[m]>
A description of the internals of OpenSCAD itself?
<JordanBrown[m]>
Not really, other than the source and the comments in it.
<Guest21>
no, no a doc for the cpp source code
<Guest21>
ok
<JordanBrown[m]>
Are you wanting to write OpenSCAD programs to produce 3D models, or are you wanting to modify OpenSCAD itself in C++?
<Guest21>
is this channel dedictaed for the developper ?
<JordanBrown[m]>
Nope, users are welcome.
<JordanBrown[m]>
There are a mix of user and developer conversations.
<Guest21>
i want to modify the C++ source code to add some physics
<Guest21>
in fact i'm looking for an open source 3d modeller, for the moment openscad is my preferate choice
<JordanBrown[m]>
I don't think there's any real internals documentation other than the comments in the source.
<Guest21>
I already dowload it, but i ask if someone did a doc !
<JordanBrown[m]>
Yeah, sorry, no.
<JordanBrown[m]>
I'm not really sure how physics would fit in, because physics usually involves motion and OpenSCAD generates static models.
<Guest21>
in fact i already know it, nobody like to write docs !
<Guest21>
are you a developper of openscad ?
<Guest21>
if yes maybe you can tell me briefly how the engine works ?
<JordanBrown[m]>
I guess I qualify; I've done some work on it.
<JordanBrown[m]>
Which engine - the language engine, or the geometry engine?
<Guest21>
the geometry engine
<JordanBrown[m]>
Executing the program yields a Constructive Solid Geometry tree, a tree of operations and objects.
<JordanBrown[m]>
There are two distinct geometry engines.
<Guest21>
ok
<Guest21>
CSG is a standard ?
<JordanBrown[m]>
The preview engine uses GPU-style operations to generate an image. For instance, to display a polyhedron it sends a collection of triangles to the underlying OpenGL, and OpenGL writes them to the screen, only writing new pixels if they are in front of what's already there.
<JordanBrown[m]>
CSG is a standard *concept*. I don't think there's a standard in the sense of data structures.
<JordanBrown[m]>
The preview engine does most of the operations magically - for instance, for unions it does the same thing as for polyhedra, throwing triangles at OpenGL and letting OpenGL figure out what's in front.
<Guest21>
how is the tree of operation converted to vertex for OpenGl ?
<JordanBrown[m]>
The preview engine does *not* do real geometry calculations. It doesn't know anything other than what pixels end up in front.
<Guest21>
ok i see
<JordanBrown[m]>
The tree of operations will say things like
<JordanBrown[m]>
same cube, but the node above it translates it.
<Guest21>
this is the internal script i guess ?
<Guest21>
(i try it a bit)
<JordanBrown[m]>
More or less, yes. For simple cases the text presentation of the internal representation looks like OpenSCAD input.
<Guest21>
ok
<JordanBrown[m]>
The render engine actually *does* the operations, discarding triangles that are cut away or end up inside the object, cutting triangles up where they interact with other triangles, et cetera.
<Guest21>
ok
<JordanBrown[m]>
The result is a single polyhedron.
<JordanBrown[m]>
I don't happen to know whether the internal form has connectivity information like how the triangles are connected to one another. The usual output form, STL, does not - it's just a collection of triangles, and the consumer needs to infer 3D objects from those triangles.
<JordanBrown[m]>
The Wikipedia article looks like a good intro to CSg.
<Guest21>
Thank you for your precious help
<JordanBrown[m]>
Depending on what kind of physics work you're interested in doing, you might be better off writing OpenSCAD-language programs.
<JordanBrown[m]>
It would be pretty easy, for instance, to write a program that animated a bouncing ball.
<Guest21>
ho, what i plan to do is very ambitious and will take months if not years ! It is for making plasma physics simulation (static). I have my own plasma equation to implement
<Guest21>
i'm looking for an open source 3d modeller that i can modify, to setup some surface properties
<JordanBrown[m]>
You mean properties of the surface of the object?
<Guest21>
no not of the surface itself like shading but properties like temperature
<Guest21>
lets to creat an inherited class of object with physics properties
<Guest21>
(sorry for the english mistakes)
<JordanBrown[m]>
I suspect that while OpenSCAD might be useful in presenting the results of the simulation, it wouldn't be helpful in *doing* the simulation.
<JordanBrown[m]>
It doesn't really have any notion, for instance, of collision.
<Guest21>
ok
<JordanBrown[m]>
So while it might help you to visualize a particle flying through space, it won't help you figure out when the particle hits something.
Lagopus has joined #openscad
<JordanBrown[m]>
teepee thanks for that pointer... I guess I need to spend some time taking a broad look at the source tree.
<Guest21>
that you for your advice, it is very helpful to evaluate what can and cannot do openscad as it is now
<JordanBrown[m]>
Happy to help.
<JordanBrown[m]>
You *might* want to look at Unity, which has more simulation-y features.
<JordanBrown[m]>
It *does* understand the notion of collisions.
<JordanBrown[m]>
But I hate using it for modeling.
<Guest21>
Unity 3D is also not applicable in my case for other reasons
<JordanBrown[m]>
OK
<Guest21>
i'm not focus on collision, in fact plasma physics does not use collision
<teepee>
to me that sounds like Blender :)
<Guest21>
there is too many particuls in a plasma to uses a collsion type simulation
<Guest21>
it was my second choice, but i dislike Blender...
<teepee>
aww
<Guest21>
i found it not user friendly, but if i have no other choice !
<teepee>
I'm not sure about the details, but considering it has a physics engine and other stuff it's probably not a bad base
<teepee>
both OpenSCAD and Blender are mesh based though, not BREP if that matters
<teepee>
with OpenSCAD maybe being 0.363% of the feature set of Blender :D
<Guest21>
yes it matters
<Guest21>
in any case thank you very much for your answers
<Guest21>
I wish you a good {morning, afternoon, evening}, and again thank you for the help. Bye
<JordanBrown[m]>
Sure, good luck.
Guest21 has quit [Quit: Client closed]
teepee_ has joined #openscad
teepee has quit [Ping timeout: 255 seconds]
teepee_ is now known as teepee
ur5us has quit [Ping timeout: 255 seconds]
guso78ggg has joined #openscad
guso78ggg has quit [Client Quit]
guso78ggg has joined #openscad
<guso78ggg>
Hey, my App appears to work
<teepee>
cool, what App?
<guso78ggg>
Managed to get qirc Lite App working in android
<guso78ggg>
IRC.libera.chat and 6697 are the Key settings, i believe
<teepee>
yup
<teepee>
+TLS
<guso78ggg>
Just ganz Access my native Account yet.
<JordanBrown[m]>
I’m mostly liking Element.
<guso78ggg>
teepee, Hope you can handle all the pr in parallel ....
<teepee>
once I dug out of the work stuff, hopefully :)
<teepee>
should be better for a bit, but there's going to be another run of 2-3 weeks of go-live-crazyness
<guso78ggg>
New Offset Feature hast a Display issue in opencsg only
<teepee>
and I'm a bit sad not making it to fosdem
Guest81 has joined #openscad
Guest81 has quit [Client Quit]
guso7878 has joined #openscad
peeps[laptop] has joined #openscad
use-value1 has joined #openscad
peeps has joined #openscad
ur5us has joined #openscad
use-value has quit [Ping timeout: 260 seconds]
use-value1 is now known as use-value
peeps[laptop] has quit [Ping timeout: 260 seconds]
peeps is now known as peeps[laptop]
guso7878 has quit [Ping timeout: 260 seconds]
Lagopus` has joined #openscad
Lagopus has quit [Read error: Connection reset by peer]
guso78ggg has quit [Read error: Connection reset by peer]
use-value1 has joined #openscad
use-value has quit [Ping timeout: 264 seconds]
use-value1 is now known as use-value
use-value has quit [Ping timeout: 252 seconds]
use-value1 has joined #openscad
use-value1 is now known as use-value
Lagopus` has quit [Quit: ERC 5.4 (IRC client for GNU Emacs 28.2)]