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

Already on GitHub? Sign in to your account

lookup function returns unexpected result [$20 awarded] #322

Closed
MichaelAtOz opened this Issue Mar 26, 2013 · 15 comments

Comments

Projects
None yet
6 participants

Playing with the lookup function, it seems to return incorrect result for key>(max key in vector)

eg

v=[ [-200, 60],
    [-170, 40],
    [-150, 30],
    [-100, 20],
    [-50,  10],
    [-5,    5],
    [0,    -5],
    [100,-50],
    [150, -80],
    [210, -100],
    ];
for (i=[-250:25:250]) {
    translate([i,0,((lookup(i,v)<0)? lookup(i,v) : 0)]) 
        cube([10,10,abs(lookup(i,v))]);
    echo(i,lookup(i,v));
}
for (i=[0:len(v)-1])
    translate([v[i][0],-10,((v[i][1]<0)? v[i][1] : 0)]) 
        color("red",0.2)
            cube([10,10,abs(v[i][1])]);

produces
OpenSCAD lookup
I would have though for >=210 it should return -100, (or perhaps interpolate from the last two points).

The $20 bounty on this issue has been claimed at Bountysource.

Owner

kintel commented Mar 26, 2013

We don't have a testcase for the lookup function. This should be added while fixing this issue.

@NateTG NateTG referenced this issue May 9, 2013

Merged

Update func.cc #358

Contributor

NateTG commented May 9, 2013

Sorry, still figuring out git, and testcase stuff
Lines 357-360 of func.cc should be:
if (p <= low_p)
return Value(high_v);
if (p >= high_p)
return Value(low_v);
instead of
if (p <= low_p)
return Value(low_v);
if (p >= high_p)
return Value(high_v);

@kintel kintel added a commit that referenced this issue May 9, 2013

@kintel kintel Added testcase for #322 3780677

@kintel kintel closed this May 9, 2013

Owner

kintel commented May 10, 2013

Nate fixed it. Nate: there is a $20 experimental bounty on this issue. Claim it if you want :) ..or re-bounty if you didn't do it for the bounty.

Contributor

NateTG commented May 11, 2013

I was wondering about that. The bounty thing confuses me a little. (I'm a bit slow at times.) I submitted it, I guess I have to wait two weeks now.

Owner

kintel commented May 11, 2013

The bounty is an ongoing experiment in trying to motivate people to contribute to OpenSCAD, both because we need more developers, and because we're uncertain what is missing in order to facilitate new developers getting started.

module get_defeloper(){

On 11 May 2013 18:26, Marius Kintel notifications@github.com wrote:

The bounty is an ongoing experiment in trying to motivate people to
contribute to OpenSCAD, both because we need more developers, and because
we're uncertain what is missing in order to facilitate new developers
getting started.


Reply to this email directly or view it on GitHubhttps://github.com/openscad/openscad/issues/322#issuecomment-17762826
.

stempeldergeschichte@googlemail.com karsten@rohrbach.de

P.S. Falls meine E-Mail kürzer ausfällt als Dir angenehm ist:
Ich probiere gerade aus kurze Antworten statt gar keine Antworten zu
schreiben.
Wenn Du gerne mehr lesen möchtest, dann lass es mich bitte wissen.

P.S. In case my e-mail is shorter than you enjoy:
I am currently trying short replies instead of no replies at all.
Please let me know, if you like to read more.

Enjoy!

module get_developer(){
create_error_in_code();
put_up_bounty():
get_developer();
}

On 11 May 2013 21:22, Peter Falke stempeldergeschichte@googlemail.comwrote:

module get_defeloper(){

On 11 May 2013 18:26, Marius Kintel notifications@github.com wrote:

The bounty is an ongoing experiment in trying to motivate people to
contribute to OpenSCAD, both because we need more developers, and because
we're uncertain what is missing in order to facilitate new developers
getting started.


Reply to this email directly or view it on GitHubhttps://github.com/openscad/openscad/issues/322#issuecomment-17762826
.

stempeldergeschichte@googlemail.com karsten@rohrbach.de

P.S. Falls meine E-Mail kürzer ausfällt als Dir angenehm ist:
Ich probiere gerade aus kurze Antworten statt gar keine Antworten zu
schreiben.
Wenn Du gerne mehr lesen möchtest, dann lass es mich bitte wissen.

P.S. In case my e-mail is shorter than you enjoy:
I am currently trying short replies instead of no replies at all.
Please let me know, if you like to read more.

Enjoy!

stempeldergeschichte@googlemail.com karsten@rohrbach.de

P.S. Falls meine E-Mail kürzer ausfällt als Dir angenehm ist:
Ich probiere gerade aus kurze Antworten statt gar keine Antworten zu
schreiben.
Wenn Du gerne mehr lesen möchtest, dann lass es mich bitte wissen.

P.S. In case my e-mail is shorter than you enjoy:
I am currently trying short replies instead of no replies at all.
Please let me know, if you like to read more.

Enjoy!

Contributor

GilesBathgate commented May 21, 2013

About 2 years ago I had a similar idea to this "Bug Bounty", and drafted up a blog post titled "Micro Employment" Basically the idea was to offer bitcoins in payment for making improvements to the RapCAD. I decided that the idea was unfairly competitive and so never went through with it. (I even went so far as buying $10 worth of bitcoins, which are worth a lot more now than what I paid for them) I might revisit the idea, as I would really like to re-ignite adoption of RapCAD. It has a lot of great features, and although there has been interest in porting some of these into OpenSCAD I think some of them would require architectural changes that are too high risk for OpenSCAD to adopt at this time. On the other hand RapCAD is missing a robust implementation of linear_extrude() and completely lacking rotate_extrude() So completion of those modules would be the first things I would offer up a bounty for. Is anyone interested?

Owner

kintel commented May 21, 2013

I think architecture changes to OpenSCAD will happen, gradually, so it's mostly a matter of taking the time to refactor code to allow for this to happen, and keep writing tests to ensure nothing breaks in the process.

One of the major differences is that RapCAD strategically didn't go for a preview mode, which makes it possible to utilize CGAL in a more coherent fashion, while OpenSCAD strives towards using CGAL only for the final compilation and not for preview (we're not quite there yet though).

..and I do like the cleanliness of your parser code :)

Contributor

GilesBathgate commented May 21, 2013

The architectural differences I had in mind were declarative vs imperative (i.e variables that can change), and the 2D subsystem implemented using 3D. I've never been really interested in implementing a lot of things that OpenSCAD already does. What's the point right? it would be just re-inventing the wheel. On the other hand I've had to re-implement some things, otherwise it wouldn't be useable. That brings me to the point you make about OpenCSG preview, I didn't have much interest in implementing that. OpenSCAD already does this well, so I would just be copying code for the sake of it. It does make it coherent, but it can be slow. There is also no caching of CGAL objects which doesn't help the speed either. Those things aside, implementing linear_extrude() and rotate_extrude() seem pointless as well at first glance since OpenSCAD already implements those. But as I have mentioned before, I am trying to implement those modules using 3D primitives, and CGAL doesn't seem to offer a neat way of doing this easily.

Member

donbright commented May 21, 2013

how much is the bounty?

Contributor

GilesBathgate commented May 22, 2013

I am thinking a couple of bitcoins for each of the above two modules. I am opening issues in RapCAD to continue discussion there.

Regards,
Giles

Contributor

NateTG commented May 24, 2013

..or re-bounty if you didn't do it for the bounty.

Any particular place you'd like to see it? Otherwise, I'll just send it to the EFF.

Owner

kintel commented May 24, 2013

The idea of the bounty was to motivate new developers to get involved, combined with motivating non-developers to add to the bounty, creating more motivation. Not sure it will work and if we should focus on features vs. bugs.
In terms of features, SVG import, svg export, obj export are nice and stand-alone.
Otherwise, there are tons of bugs and other issues. Put it where you want to see improvement.

@donbright donbright pushed a commit that referenced this issue Nov 10, 2013

@NateTG NateTG Update func.cc
Fix for #322
715d539

@kintel kintel changed the title from lookup function returns unexpected result to lookup function returns unexpected result [$20 awarded] Feb 21, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment