[Question]
  [
This [impossible object](https://en.wikipedia.org/wiki/Impossible_object) is [Reutersvärd's triangle](https://commons.wikimedia.org/wiki/File:Reutersv%C3%A4rd%E2%80%99s_triangle.svg):
[![enter image description here](https://i.stack.imgur.com/Ec4du.png)](https://i.stack.imgur.com/Ec4du.png)
Draw your own version according to these rules:
* Exactly 9 cubes total
* Each side is made up of exactly 4 cubes
* The cubes appear to overlap such that the rendered object is in fact an impossible object
* 4 distinct colours are used - one for the background and 3 for each of the faces of the cubes
* In bitmap output, the full triangle should be at least 100 pixels tall and at least 100 pixels wide
* Aspect ratio: the width and height of the full triangle should not be off by more than a factor of 2
* The triangle may be rotated by any amount relative to the above image
* The triangle may or may not be reflected relative to the above image
  
[Answer]
# Mathematica, 237 bytes
```
n={-1,1}#&;c_~g~s_:=Polygon[c+s#&/@{k={12,9},m=n@k,t={0,-12}}];p={#,#2~g~1,#3~g~-1}&;a=p[Cyan,#-k,#+m]&;b=p[Blue,#-t,#+k]&;c=p[Red,#-m,#+t]&;Graphics@{{a@#,b@#,c@#}&/@{j=4k,s=4{4,9},n@s,4m,r={-32,8},q=-4{4,5},4t,n@q,n@r},a@j,b@s,c@j,c@s}
```
Easier-to-read version:
```
1  n = {-1, 1} # &;
2  c_~g~s_ := Polygon[c + s # & /@ {k = {12, 9}, m = n@k, t = {0, -12}}];
3  p = {#, #2~g~1, #3~g~-1} &;
4  a = p[Cyan, # - k, # + m] &;
5  b = p[Blue, # - t, # + k] &;
6  c = p[Red, # - m, # + t] &;
7  Graphics@{
8    {a@#, b@#, c@#} & /@
9      {j = 4 k, s = 4{4, 9}, n@s, 4 m, r = {-32, 8},
10       q = -4{4, 5}, 4 t, n@q, n@r},
11   a@j, b@s, c@j, c@s}
```
Line 1 defines a function `n` that negates the first coordinate of an ordered pair. Line 2 defines a function `g` that produces a (roughly) equilateral triangle centered at the point `c`, and pointing down or up depending on whether `s` is `1` or `-1`. Line 3 defines `p` to be a parallelogram template consisting of a color and two triangles, and lines 4–6 define `a`, `b`, and `c` to be the three different specific types of parallelograms that appear in the cubes.
Line 8 defines a function `{a@#, b@#, c@#}&` that draws an entire cube centered at the point `#`; lines 9 and 10 apply that to the nine points needed to make the larger triangle. This produces nine cubes, starting at the upper right and going counterclockwise, where the later ones cover up parts of the earlier ones. Finally, line 11 redraws four parallelograms (in the upper right of the picture) so that they end up covering the later cubes as they're supposed to. The output is below:
[![enter image description here](https://i.stack.imgur.com/3xOue.png)](https://i.stack.imgur.com/3xOue.png)
[Answer]
# Brain-Flak, ~~487810~~ ~~327722~~ 75564 + 1 = 75565 bytes
Unfortunately this is a tad big to fit in an answer.
[PasteBin](http://pastebin.com/WqRM1HNY)
[Try it Online](https://tio.run/nexus/brain-flak#7Z1rbhsxDISvs/rRGwQBeo4gJzF8djcvJ/ZaAbyudkQOvyQ/Cu@iAsfU6EFyeFo@ftr7bzscf/6ens8ffz1YDseXpb0@/Xz8@WB5e/Pz/dYeffbcjofjcvXG2yt3jdoeeXIeD/uwL7J9D4w30MozGUi@wwH/5YV5DazACqxmYfX9wJebPz7fZYQLm6xXNxAEwRIIXjL5XeOlxFGC5f3jZFuDwQ/8/PE7j7PYnmetmZDVBAzBEFZ8FEmNP4If@IFfUvyuX/CNWu33nU30RRAEwWoICjmROP6wvbY0sibyEixLOrMnxAXwESwraZlolZk1r1mx8f96lgk8v0pGBP7PyhYwB3pDbIQIfyD/Zz8Ca1We2azaWFZ2Zt@f8UqMgVUNy5jVv2cCjJjG@AKWcZbeUpcXeAY7r8HsL@CngZoAcey7c5@dds5hXwn7xOtozvMtvoJ9zPUK9QN4CvY5zfRGNApvwT5me/msEnwF@3zsE@d@s7YzH7CP@c7qzmzAPg/7Gqs7/pLiZJss0s5cn7Wyx4lqxMmLiIZf/EwqFLKVDCjNbJqhSmg5i2HBVLHxIZnuQdX8XFnRWZ9Qti@Mpx2cjROlCLpzopvas5QZ1RrW93JUzr0izOiH4DhuXEzv@GDGpMyo3DGGirMmZEUVI/pzop2GtpwXhZzoHUuFF73wG8eL5tFgOBFO3BbLbP87oCcDTlKSNt@1OXLU9Xi@veS0@VvrYwyIjkH0csKbKmmLVVome6o3qt@bMtuODmI13nUg3ZlXxWvVj6/iqfk91RbVaya33a1K68zXyyOIDmTVxDczAdV9l0pnADmqX5Ca9hVU69j671TliE67qxp8@TaNU0IrwKZl6jl3C@ZZk3isE7JTvVZXGyvfubXNI4JrlfNbcGwTn@Hw2hh8sKjXr7PP2jPtMi9WZs8HxCDw2mx8MAPXnNGdyLjW2neRQ4PXplPVEvbIjJYjWLfXbkQVp/UUKKDlZDn3xlZMVMi5G4iVobrbZF5Q6xlZcYJtZaRW78dT02ICe9jXcTsyiKcOj1IVB/7Iyx/a/Ycbc7hyh1Zt0JNB5NUjBVQH/fhDwyCuOw@4Iy93yHt3JdRacVWVt9Wn08ZOBvr0KqV5KdHvIjUn6POxnSyb0rFrj9laQO0kba@6cKpDncsm7@pYaWbqzpWj07KWel5jzTRSrtm5nmKaDs/N1ba7uskiZxtH23riDQV0MWRes1jadluQ6676oc3vU@5rhPWFt15jzjTanY2nbR2veR/Ql22Up42kOuZbPSe3mnJYXQ7tHXwE5imgNpBtzcJ7yumrtFnM0ziTp0d3Uo@4St5jrDcyM5eG2ENudMetknhPNQWOcbvXbb6j8pyeML8/8zSvO54pWT6FPFSvJ4Kiwe45iOG@ka48WQH9Dir1w@d0lvF/tU4FNeahYx/CCulu80F7lQUqpXOoBFSZAUr@dzyB@nm/Moe4To07vo/vx/F9eVzJscpQlxXQlxMyzYSec9u6Ko@mv/wO6HpXC7Wpnpu6tj9mvVJvkS5QfTIPW7okj2aGTxsTd4OKWSfyC770jgXhTL1OY6Ds3J3TZp0D4aJdD41OGWBctKec0R0PCJfrgtY/nLfjgU5XVvg6dgzq9fY9FsjyqYOtW5@JLqoFMtPqIJtXn7zfd7pQ5eRwhV3xPvXi54a4bz57/9fLbej/ddubq@uRLxA6iYen0@nP338)
With the `-A` flag this outputs an ASCII ppm file that looks as follows:
[![New output](https://i.stack.imgur.com/XoHnl.png)](https://i.stack.imgur.com/XoHnl.png)
# Explanation
You may have already guessed I did not write this by hand. So here's how I did it:
I first made the image you see above from the image provided by the challenge. It has the distinction of having no color channel that is at any value other than `255` or `0` this way we can wrap it up into a smaller file with the max color channel set to 1. I then wrote a python script to golf a Brain-Flak program that solves this using a module I wrote myself that can be found [here](http://pastebin.com/zbbn5vJ0). Its not very polished its just a hack I threw together for things like this. `push` is a function that returns efficient Brain-Flak code to push a number to the stack and `kolmo` is a very simple Kolmogorov complexity solving program that attempts to find an efficient way to push a particular string to the stack.
```
from value import push,kolmo
def group(a, n):
    return zip(*[a[i::n]for i in range(n)]) 
f=open("R.ppm")
a=["".join(x)for x in group(f.read().split()[3:][::-1],3)]
f.close()
def hardcode(string):
    result = push(ord("\n")).join("(<>({})<>"+{"0":"","1":"()"}[x]+")"for x in string)
    return result
last = ""
acc = 0
result = push(ord("0"))+"<>"
for x in a+[""]:
    if x != last:
        string = ("" if not last else kolmo("\n")+hardcode(last))
        result += min([push(acc)+"{({}[()]<%s>)}{}"%string,acc*string],key=len)
        acc=1
    else:
        acc += 1
    last = x
print result+kolmo("P3 100 100 ")
```
This was quite fun and I hope to improve my answer
[Answer]
# HTML + CSS 3D (855 ~~866~~ bytes)
HTML *117 bytes* + CSS *738 bytes*
To keep the `z-indexes` in order was a bit tricky. ;)
```
/* CSS */
p{position:absolute;left:110px;top:0;width:50px;height:50px;transform-style:preserve-3d;transform:rotateX(-45deg)rotateY(21deg)rotateZ(20deg)}
p+p{left:140px;top:50px}
p+p+p{left:170px;top:100px}
p+p+p+p{left:200px;top:150px}
p+p+p+p+p{left:140px;top:150px}
p+p+p+p+p+p{left:80px;top:150px}
p+p+p+p+p+p+p{left:20px;top:150px}
p:nth-child(8){z-index:1;left:50px;top:100px}
p:nth-child(9){z-index:-1;left:80px;top:50px}
p:nth-child(10){z-index:1;left:67px;top:59px;transform:rotateX(-45deg)rotateY(21deg)rotateZ(20deg)scale(0.6)}
a{position:absolute;width:50px;height:50px;background:red;transform:rotateY(0deg)translateZ(25px)}
a+a{background:tan;transform:rotateY(-90deg)translateZ(25px)}
a+a+a{background:navy;transform:rotateX(90deg)translateZ(25px
```
```
<!-- HTML -->
<p><a><a><a><p><a><a><a><p><a><a><a><p><a><a><a><p><a><a><a><p><a><a><a><p><a><a><a><p><a><a><a><p><a><a><a><p><a><a>
```
I've kept the new lines for better readability. Maybe somebody spots potential for more golfing. However, they are not included in the byte count.
## Result
[![enter image description here](https://i.stack.imgur.com/4UMFT.jpg)](https://i.stack.imgur.com/4UMFT.jpg)
## jsFiddle Demo
[Try it yourself](https://jsfiddle.net/eh2mgjfn/)
Use Goole Chrome. Other browsers may have [problems with the `z-indexes`](https://stackoverflow.com/q/5472802/1456376).
## Edit
* Saved **2 bytes** by removing the duplicate `a`-selector, thanks to [ETHproductions](https://codegolf.stackexchange.com/users/42545/ethproductions).
* Saved **9 bytes** by removing an unnecessary `margin:0` on the `a`-element.
[Answer]
# BBC BASIC, 147 bytes
tokenised filesize 129 bytes
```
t=PI/1.5x=500y=x:FORi=0TO28b=i MOD3GCOL0,b:b*=t:a=i DIV9*t:IFb=0x-=99*COSa:y-=99*SINa
MOVEx,y:VDU25;66*COSb;66*SINb;28953;66*COS(b-t);66*SIN(b-t);:NEXT
```
2 bytes saved by using an absolute coordinate specification (`MOVE`) and two relative specifications per parallelogram, instead of changing the origin in order to be able to use all absolute specifications. 1 byte of unnecessary whitespace eliminated.
# BBC BASIC, 150 bytes
tokenised filesize 127 bytes
Download interpreter at <http://www.bbcbasic.co.uk/bbcwin/download.html>
```
t=PI/1.5x=500y=x:F.i=0TO28b=i MOD3GCOL0,b:b*=t:a=i DIV9*t:IFb=0 x-=99*COSa:y-=99*SINa:ORIGINx,y
L.66*COSb,66*SINb,0,0PLOT117,66*COS(b-t),66*SIN(b-t)N.
```
**Explanation**
We start with the coordinates at top right and plot rhombuses in groups of 3. Before each group of 3 we move the origin (West, West, West, SE, SE SE, NE, NE NE.) That means that the group of 3 at top right is the last complete group to be plotted, bringing the origin back to its original location. We then continue and plot the black and red (but not the green) of the first group again, a total of 29 rhombuses.
**Ungolfed**
```
  t=PI/1.5                                 :REM 120 deg
  x=500                                    :REM coordinates of top right corner
  y=x
  FORi=0TO28
    b=i MOD3:GCOL0,b                       :REM set colour 0=black,1=red,2=green
    b*=t                                   :REM convert b to a multiple of 120deg
    a=i DIV9*t
    IFb=0 x-=99*COSa:y-=99*SINa:ORIGINx,y  :REM before each group of 3 rhombs move the graphics origin
    LINE66*COSb,66*SINb,0,0                :REM define one side of a rhombus
    PLOT117,66*COS(b-t),66*SIN(b-t)        :REM define one further corner and plot the rhombus
  NEXT
```
**Output**
[![enter image description here](https://i.stack.imgur.com/Wvy6z.png)](https://i.stack.imgur.com/Wvy6z.png)
[Answer]
# HTML + JavaScript (ES6), 351 ~~374 384~~
```
<canvas id=C></canvas><script>c=C.getContext("2d");`133124222162184253104213162164244191224182133191064104222093164253122224284151284`.match(/.../g).map((v,i)=>(c.fillStyle=['#fc0','#f04','#08a'][a=i%3],c.beginPath(),c[l='lineTo'](x=5*~~v/10,y=v%10*25),c[l](x-10,y+(--a+!a)*17),a&&c[l](x-30,y+a*17),c[l](x-20,y),!a&&c[l](x-10,y-17),c.fill()))</script>
```
*Less golfed*
```
<canvas id=C></canvas>
<script>
  c=C.getContext("2d");
  [133,124,222,162,184,253,104,213,162,164,244,191,224,182,133,191,64,104,222,93,164,253,122,224,284,151,284]
  .map((v,i)=>(
    a = i % 3,
    x = 5 * ~~ v / 10,
    y = v % 10 * 25,
    c.fillStyle = ['#fc0','#f04','#0a8'][a],
    c.beginPath(),
    --a,
    c[l='lineTo'](x, y),
    c[l]( x -10, y + (a+!a) * 17),
    a&&c[l](x - 30, y + a * 17),
    c[l](x - 20, y),
    !a&&c[l](x - 10, y - 17),
    c.fill()
  ))
</script>
```
**Test**
```
<canvas id=C></canvas><script>c=C.getContext("2d");`133124222162184253104213162164244191224182133191064104222093164253122224284151284`.match(/.../g).map((v,i)=>(c.fillStyle=['#fc0','#f04','#08a'][a=i%3],c.beginPath(),c[l='lineTo'](x=5*~~v/10,y=v%10*25),c[l](x-10,y+(--a+!a)*17),a&&c[l](x-30,y+a*17),c[l](x-20,y),!a&&c[l](x-10,y-17),c.fill()))</script>
```
[Answer]
## JavaScript(ES6)/SVG(HTML5), ~~350~~ 312 bytes
```
document.write(`<svg width=390 height=338>`)
a=`195,52;240,130;285,208;330,286;240,286;150,286;60,286;105,208;150,130;`
a=(a+a).split`;`
for(i=9;i--;)document.write(`<path fill=#FD0 d=M${a[i]}h60l-30,-52h-60z /><path fill=#088 d=M${a[i+3]}h60l-30,52h-60z /><path fill=#F64 d=M${a[i+6]}l-30,-52l-30,52l30,52z />`)
```
[Answer]
# SVG, ~~562~~ ~~540~~ ~~520~~ ~~504~~ ~~487~~ 473 bytes
This is my first time golfing SVG (or any markup, in fact); be gentle!
The assumed viewing environment is an SVG-capable web browser with anything like a typical window size. I tested it in Firefox 50 and in Chrome 55.
The `viewBox` is necessary to meet the 100-pixel requirement; blowing up all measurements by a suitable factor would also work but would take more bytes. Incidentally, it is possible to save another byte by removing the space in `0 -5` in the `viewBox` value, but Firefox won't accept this as valid (whereas Chrome will).
The aspect ratio is 1:1 instead of the true 0.866:1. I'm not sure exactly how the "factor of 2" rule is meant to be interpreted (I think it means that exaggeration as extreme as 0.433:1 or 1.732:1 is acceptable), but I'm pretty sure this meets the requirement anyway.
## SVG
```
<svg xmlns="http://www.w3.org/2000/svg"
xmlns:l="http://www.w3.org/1999/xlink"
viewBox="0 -5 26 26"><g
id="a"><path d="m7,9H3V5h6z"/><g
id="f"><path fill="red" d="m9,5H3V1h4z"/><path
fill="blue" d="m3,1l2,4L3,9l-2-4z"/></g></g><use
l:href="#a" x="3" y="6"/><use
l:href="#e" x="12"/><g
id="e"><use l:href="#a" x="-6" y="12"/><use l:href="#a" x="-12" y="12"/></g><use
l:href="#a" x="-9" y="6"/><use
l:href="#a" x="-6"/><use
l:href="#a" x="-3" y="-6"/><use
l:href="#f"/></svg>
```
## Result
[![A PNG rendering of the above SVG code for Reutersvärd's Triangle](https://i.stack.imgur.com/CxYA6.png)](https://i.stack.imgur.com/CxYA6.png)
[Answer]
# [Python 3](https://docs.python.org/3/) + Turtle, 389 bytes
```
from turtle import*
a='#2e6f6e','#FAD028','#E44834'
L=lt;F=fd;B=begin_fill;E=end_fill
Z=0,1,2
pu()
ht()
speed(0)
for m in Z:L(120);F(30);L(60);F(30);L(60);[[[[color(a[j-m]),B(),[F(20)==L((5-i%2)*60)for i in(1,)+Z],E(),L(120)]for j in Z],k%2and[L(180),F(30),L(180)]or[L(300),F(30),L(60)]]for k in Z]
L(120)
F(30)
L(60)
F(10)
for k in[2,1]:color(a[k]);B();[F(20)==L(240)for i in Z];E();L(60)
```
From Bubbler's golf of -131 bytes!
[Try it online!](https://tio.run/##XU/LboMwELz7K5CiCDt1JGMoQrF8aFQ48QUgq6LFNISHkUsO/Xq6mFap4sNqvLMzOzt9zxczhsvSWDN4883OvfbaYTJ2PqBK@juu4ybWPvV32csr48mK0ihKwshHuexnkcmmFmf5rj/b8a1p@16kUo@1g6iQjAaUo@mGCbrMUL4mrWvMCGqM9QavHb3ilOOAMyIyHELNcfyAS3gfpjcWV@X1OChCz5jQMsMgkjLH@PnY7jk5wOxq2oIpDih5KhRNYXBzVyt1dfsU7fa8GusSmIQR6nbR7aOMhXbI/rXBVjl1t6nRZogcjxwPOPg9aR0qOQ3U6S9yp4iAwOIemEf3pGAoIOV26rL8AA "Python 3 – Try It Online")
# [Python 3 + Turtle](https://docs.python.org/3/), 537 520 bytes
```
from turtle import*
a=['#2e6f6e','#FAD028','#E44834']
pu()
ht()
speed(0)
for m in range(3):
	lt(120);fd(30);lt(60);fd(30);lt(60)
	for k in range(3):
		for j in range(3):
			color(a[j]);begin_fill()
			for i in range(4):fd(20);rt(120 if i%2==0 else 60)
			end_fill();lt(120)
		if k==1:rt(180);fd(30);lt(180)
		else:rt(60);fd(30);lt(60)
	a=a[2:]+a[:2]
lt(120)
fd(30)
lt(60)
fd(10)
a=[a[2],a[1]]
for k in range(2):
	color(a[k]);begin_fill()
	for i in range(3):fd(20);rt(120)
	end_fill();lt(60)
turtle.Screen().exitonclick()
```
-17 bytes from Dion, after removing unnecessary whitespace.
[Try it online!](https://tio.run/##bVHLasMwEDxbXyEIxVIbgi2bEBx8KLT9gR6NKKqzThQrklEUaL/eXeVBiduLVrOa2d1ZDd9h52wxjp13BxpOPhig@jA4Hx6Jqpt0JmDZLSGdp7O355dMrOLttSxXRZlKMpwYJ7uAx3EA2LCMk855eqDaUq/sFljBK5KYwHKR8XW3YQUGhMspIkkU9hPhObmfJpPWGeeZavaSrz9hq@1Hp43BKZKLQv8qSl5hn9jcn4eguqP6QdR1RsEcgZ5bJwnYzbXG@josZpHa13VeReXqbuAIkRArxNd/3KhaNaKST6qphCS3mhcSuZIQ5RhwzciVc9XkUpLJGkR0fPPb//E7cVtM3CLj3llse/nlxXvrASzjC/jSwdnW6LZnfBx/AA "Python 3 – Try It Online")
[![enter image description here](https://i.stack.imgur.com/BaG9g.gif)](https://i.stack.imgur.com/BaG9g.gif)
gif made from [cdlane's instructions!](https://stackoverflow.com/a/41353016/4568534)
]