Skip to content

Is vector4 intended to be = to clojure persistent vector? #3

@joinr

Description

@joinr

Messing with some pixel operations, scanning to eliminate blank pixels (naively), I want to filter out
[255.0 255.0 255.0 255.0] and record [x y] coords that are non-blank...

(defn extract-outline [pixels]
  (let [blank [255.0 255.0 255.0 255.0]
        [w h] ((juxt c2d/width c2d/height)  pixels)]
    (->> (for  [x (range w)
                y (range h)]
           (let [p (p/get-color pixels x y)]
             (when (not= p blank)
               [x y])))
         (filter identity)
         vec)))

Input pixels is a result of to-pixels from an image. I believe a vector4 buffer.

The problem is, = between the vec4 that's stored in pixels and the literal 4-element vector I denoted is not considered structurally equal. So, every pixel is returned. I'm guessing the simple way out is to to use vec4 explicitly instead of clojure's vector. Is this intentional?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions