# Looking for Heart mapping

**URL:** <https://forum.electromage.com/t/looking-for-heart-mapping/2693>\
**Category:** Ideas and Tips\
**Created:** [December 14, 2022, 8:30am UTC](https://forum.electromage.com/t/looking-for-heart-mapping/2693 "2022-12-14T08:30:06Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![wackazong](https://forum.electromage.com/letter_avatar_proxy/v4/letter/w/9e8a1a/32.png) [@wackazong](https://forum.electromage.com/u/wackazong)\
**Post date:** [December 14, 2022, 8:30am UTC](https://forum.electromage.com/t/looking-for-heart-mapping/2693/1 "2022-12-14T08:30:06Z")

</div>

Hey there, looking for a heart mapping for Pixelblaze. I have this one but there is too many pixels where the two halves come together. I am looking for one not using a parametric function but constructing the heart from circles and lines, while keeping equal distances between the pixels.

```auto
function (pixelCount) {
  var map = [];
  var x, y;
  for (i = 0; i < pixelCount * 10; i++) {

    t = i*1;
    x = 16 * Math.pow(Math.sin(t),3);
    y = 13 * Math.cos(t) - 5* Math.cos(2*t) - 2 * Math.cos(3*t) - Math.cos(4*t)

    map.push([x,-y])
  }
  return map
}

```

---

<div class="post-metadata">

**Author:** ![wackazong](https://forum.electromage.com/letter_avatar_proxy/v4/letter/w/9e8a1a/32.png) [@wackazong](https://forum.electromage.com/u/wackazong)\
**Post date:** [December 14, 2022, 8:40am UTC](https://forum.electromage.com/t/looking-for-heart-mapping/2693/2 "2022-12-14T08:40:31Z")

</div>

Just realized this mapping does not work because it puts the pixels on the map in a more or less random fashion, not in order…

---

<div class="post-metadata">

**Author:** ![wizard](https://forum.electromage.com/user_avatar/forum.electromage.com/wizard/32/4_2.png) [@wizard](https://forum.electromage.com/u/wizard)\
**Post date:** [December 14, 2022, 3:16pm UTC](https://forum.electromage.com/t/looking-for-heart-mapping/2693/3 "2022-12-14T15:16:43Z")

</div>

Do you have a photo of your heart arrangement? It will help us understand what you are looking for, and might be usable with the photo pixel mapper tool.

---

<div class="post-metadata">

**Author:** ![wackazong](https://forum.electromage.com/letter_avatar_proxy/v4/letter/w/9e8a1a/32.png) [@wackazong](https://forum.electromage.com/u/wackazong)\
**Post date:** [December 14, 2022, 5:46pm UTC](https://forum.electromage.com/t/looking-for-heart-mapping/2693/4 "2022-12-14T17:46:53Z")

</div>

Just a simple 2d heart outline, like this: ❤

Where can I find the photo pixel mapper tool?

---

<div class="post-metadata">

**Author:** ![wizard](https://forum.electromage.com/user_avatar/forum.electromage.com/wizard/32/4_2.png) [@wizard](https://forum.electromage.com/u/wizard)\
**Post date:** [December 14, 2022, 5:52pm UTC](https://forum.electromage.com/t/looking-for-heart-mapping/2693/5 "2022-12-14T17:52:45Z")

</div>

You can find the pixel mapper tool thread and links here:

> [@2D Pixel coordinate mapping tool for images](https://forum.electromage.com/t/2d-pixel-coordinate-mapping-tool-for-images/714):
>
> Here is a quick and dirty pixel mapping tool. You can upload a photo, click to mark a coordinate on the image, press z (not control-z) to remove the last coordinate. It puts the coordinates into a text area for copying to pixelblaze mapper tab, drawing the pixel index number on the image. Remember, Pixelblaze mapper coordinates can be in any unit, pixels work too slight_smile The coordinates are in pixels from the source image. It will also accept edits/pastes into the text area to edit …

To use this, you’ll want to arrange your LED strip in a heart shape, light it up so the pixels are easily seen, and take a photo. Then use the tool to click on each in order starting with the first pixel. Copy the entire text area contents to the Pixelblaze mapper tab, and you’re set!

There’s probably a way to generate a heart outline coordinates with some code that would be more precise, but you’d have to make it match what you create in the real world which might be trickier than the build + photo + click approach.

---

<div class="post-metadata">

**Author:** ![munkisquisher](https://forum.electromage.com/letter_avatar_proxy/v4/letter/m/67e7ee/32.png) [@munkisquisher](https://forum.electromage.com/u/munkisquisher)\
**Post date:** [December 14, 2022, 9:22pm UTC](https://forum.electromage.com/t/looking-for-heart-mapping/2693/6 "2022-12-14T21:22:45Z")

</div>

Turn this into a pattern

 ![image](https://forum.electromage.com/uploads/default/original/2X/6/617588da30ea8affd26cdc9788d3687daae520f7.png)

---

<div class="post-metadata">

**Author:** ![GeekMomProjects](https://forum.electromage.com/user_avatar/forum.electromage.com/geekmomprojects/32/749_2.png) [@GeekMomProjects](https://forum.electromage.com/u/GeekMomProjects)\
**Post date:** [December 15, 2022, 6:19am UTC](https://forum.electromage.com/t/looking-for-heart-mapping/2693/7 "2022-12-15T06:19:19Z")

</div>

If you’re just looking to do a parametric outline, you can form a heart from two semi-circles and two lines, as follows (the equations look more daunting then they actually are because the way they’re formatted for the graphing program): https://www.desmos.com/calculator/5iikrdyfto. The entire shape of the heart is dependent on one parameter, “L”, which is the length of one of the straight lines.

If you know the spacing between pixels, you can figure out their positions around the heart as a function of L.

 ![image](https://forum.electromage.com/uploads/default/original/2X/0/023fab347856b6cb7bf532cd558876bd1c2710b0.png)

---

<div class="post-metadata">

**Author:** ![wackazong](https://forum.electromage.com/letter_avatar_proxy/v4/letter/w/9e8a1a/32.png) [@wackazong](https://forum.electromage.com/u/wackazong)\
**Post date:** [December 15, 2022, 7:50am UTC](https://forum.electromage.com/t/looking-for-heart-mapping/2693/8 "2022-12-15T07:50:17Z")

</div>

Wow, thanks for the support. That’s what I was looking for and did not have time to do it myself. What a great tool, too!

---

<div class="post-metadata">

**Author:** ![zranger1](https://forum.electromage.com/user_avatar/forum.electromage.com/zranger1/32/301_2.png) [@zranger1](https://forum.electromage.com/u/zranger1)\
**Post date:** [December 15, 2022, 5:19pm UTC](https://forum.electromage.com/t/looking-for-heart-mapping/2693/9 "2022-12-15T17:19:47Z")

</div>

Here’s another heart formulation that I’ve been using recently. It’s a single curve, mirrored across the y axis, that gives a really well defined heart on low-res displays. The variable `r` controls the overall radius of the heart, and `k` the (approximate) aspect ratio.

 ![image](https://forum.electromage.com/uploads/default/original/2X/2/24d37cfbdbe58ec1cf03acab0e22f4f6f14d834e.png)

---

<div class="post-metadata">

**Author:** ![GeekMomProjects](https://forum.electromage.com/user_avatar/forum.electromage.com/geekmomprojects/32/749_2.png) [@GeekMomProjects](https://forum.electromage.com/u/GeekMomProjects)\
**Post date:** [December 15, 2022, 6:56pm UTC](https://forum.electromage.com/t/looking-for-heart-mapping/2693/10 "2022-12-15T18:56:33Z")

</div>

Ooooh, that’s nice looking!
