Giter VIP home page Giter VIP logo

clisk's Introduction

mikera

Mike's general purpose Java library

Lots of good stuff inside including:

  • Maths functions
  • A set of persistent, immutable data structures
  • Bitwise operations and tools
  • Resource handling utility functions
  • GUI utilities
  • Sound utilities
  • Random number generation and algorithms (also available via the Randomz library - https://github.com/mikera/randomz)

Status

Build Status

clisk's People

Contributors

mikera avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

clisk's Issues

Add license

I could not find any information on what license is used. That
effectively means that clisk is under copright protection, which means
it's not possible to - without risk - use it for either open source
or commercial projects.

Of course you could let it stay under copyright, but I don't think
that's what you want. :)

require more explaination for the rest of us

i got to know this libarary via clojure planet, and found its really a cool one

but the problem is i dont have CV background, which let me not famillar those terms in the example codes

and the README.md seems miss a sections called "How it Works", i know i could just RTFC, but with your document, it would be better for me to quick learn this library

clojars distribution => missing checksum makes lein refuse to get the lib

Hi,

When I added to my project.clj:

A lein deps gave me:

Retrieving net/mikera/clisk/0.3.0/clisk-0.3.0.pom (2k)
    from https://clojars.org/repo/
Could not transfer artifact net.mikera:clisk:pom:0.3.0 from/to clojars (https://clojars.org/repo/): Checksum validation failed, no checksums available from the repository
Failed to collect dependencies for clojure.lang.LazySeq@45daf4cd

In the clojars repository I can see that there's no checksum.

So I put manually the jars and poms in my local repo ~/.m2 and it seems to work.

By the way I checked a lib that I used recently without this problem, here, and I can see the checksums along with the files:

Index of /repo/net/cgrand/parsley/0.9.1/

../
parsley-0.9.1.jar                                  01-Jun-2012 07:33               22247
parsley-0.9.1.jar.md5                              01-Jun-2012 07:33                  32
parsley-0.9.1.jar.sha1                             01-Jun-2012 07:33                  40
parsley-0.9.1.pom                                  01-Jun-2012 07:33                1771
parsley-0.9.1.pom.md5                              01-Jun-2012 07:33                  32
parsley-0.9.1.pom.sha1                             01-Jun-2012 07:33                  40

Cheers,

Denis

show is distorting the image, sometimes

I'm trying to render some "portrait" framed images and the display with show is distorting the Y values. Saving the images to a file renders fine, though. But, this makes it hard to interactively preview as you can imagine.

Here's a checkerboard testcase:

(let [im (image (scale 0.5 (checker 0 1))
                :width    (* (/ 1080 10) 3)
                :height   (* (/ 1920 10) 3))]
  (show im
        :width    (* (/ 1080 10) 3)
        :height   (* (/ 1920 10) 3))
  (ImageIO/write im "png" (File. "test.png")))

And this is a screen capture showing "show" on the left and an image viewer on the right.

screen shot 2015-12-02 at 5 46 52 pm

I'd expect they would match...also, I was hoping that I could just (show im) without the width/height settings, but that's less of an issue.

Hardware question

Does clisk use only CPU or does it tap into GPU resources?

If CPU does it take advantage of multi-threading?

I built a small image generation script that works on 4096px+ textures and would like to get a dedicated piece of hardware to pipe everything through. Just wondering if I should just focus on the CPU or get a good GPU.

Thank you for making this!

Seed setting for repeatability

This is like Issue #10 but my need is for it to behave properly in a multithreaded environment.

I believe that Issue 10 is solved in the single-threaded case by writing

(seed-simplex-noise! seed)
(plasma)

and the like. I'm obtaining seed from

(.nextLong (mikera.util.Random.))

I hope that's reasonable.

In the case where multiple threads may be evaluating noise expressions at the same time,
though, it's possible that another thread can get in and set the seed differently
(affecting the static variables of the Perlin or Simplex class that the noise functions rely on)
before the noise function runs.

This has indeed been happening frequently in the Clevolution app.

I think the most direct solution may be to put the relevant variables in an instance
rather than as statics in the classes for the multithreaded case.

But you may have a more elegant solution.

(To make matters worse, it appears that in the case of turbulate the func
passed in may also be a noise function that uses the Simplex class, thus
requiring a pushdown stack of seeds and their affected variables.)

Method code too large !

Hi, I was trying to generate some random images using CLISK. I think it's really cool it's entirely composable.
Here is my method : I generate a tree structure where nodes are labelled according to the fact they are
2-arity, 1-arity or 0-arity functions or constants. Then I interpret that tree using some of functions defined
in the library.
When the tree start to be a little large, the following error rises during interpretation :

clojure.lang.Compiler$CompilerException: java.lang.RuntimeException: Method code too large!, compiling:(*cider-repl imagen*:280:13)
             java.lang.RuntimeException: Method code too large!

I guess the function resulting from interpretation rises this during its compilation. That means its code
size grows way too fast compared to the tree size.
Here is a gist of the code I use, maybe I mess somewhere.

Memory leak?

I've written a library using clisk (http://github.com/rogerallen/tweegeemee) and it suffers from some slow memory leaks that I think I've traced to clisk.

To reproduce, what I did was create a new app with lein new testclisk and added [net.mikera/clisk "0.10.0"] to the :dependencies. Then in one terminal, do lein repl. In another open jvisualvm.

In jvisualvm open the clojure app in the Monitor pane watch the Metaspace memory graph.

In the repl, do:

(use 'clisk.live)
(dotimes [i 200] (image pos :size 16))

After you run that last line, press the "Perform GC" button and what I see is a sharp jump in the Used Metaspace. About 9M each time I run that command.

;; starting at Used: 109,951,136 B
(dotimes [i 200] (image pos :size 16))
;; GC, then I see: 118,946,072 B
(dotimes [i 200] (image pos :size 16))
;; GC, then I see: 127,942,064 B

I don't know how to get that memory back. Can you advise? Thanks.

MemoryError in Metaspace

I'm getting a Caused by: java.lang.OutOfMemoryError: Metaspace from sessions where I create too many clisk.live trees (4k trees of depth <10).

Relevant lines from stack trace (using the 0.11.0 release)
at clisk.util$expression_info_internal.invoke(util.clj:32)
at clisk.node$node_info.invoke(node.clj:435)
at clisk.node$validate.invoke(node.clj:451)
at clisk.core$image.doInvoke(core.clj:73)

Edit: I know the simple workaround is increasing metaspace, but I'm wondering if there is an alternative. Ideally this will run for ~100k-1m trees (or more).

Gradient

Hello Mike
I am studying the library and through rough pattern-matching on existing code without much understanding I have come up with

(defn x-gradient
  ([a b]
    (clisk.functions/lerp (vfrac x) a b)))

which I have stuck into my copy of clisk.patterns.clj.

Could you please comment on whether this is at all correct (image looks a bit off) and what would be the right thing to do?

Thanks!

require clojure.test

With lein2 and Clojure 1.4 I had to add a require statement to my ns declaration or it throws and error when not finding clojure.test

This works:

(ns myclisk.core
(:require clojure.test)
(:use [clisk core functions patterns colours]))

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.