Project Euler 126 says: "If we then add a second layer to this solid it would require forty-six cubes to cover every visible face."
How come? I thought lay another 3x2x1 over a 3x2x1 makes it 3x2x2, and you need 6 to cover the top, 6 to cover the bottom, 3+2+3+2 to cover each layer, so the total is 32, every white color face is covered, right? How am I wrong here? I have thought hard, but I don't understand. Thanks in advance.
I believe the intention is to cover the covered cuboid.
first you need 22 to cover the six sides. then you need to cover 3 different corners, which needs 3* 4 + 2*4 + 1*4 = 24. totally 46.
Related
I am trying to write a code to design a simple traffic light. However, I cannot figure out the maths behind it. Can someone help me with the logic?
saying, X is the length and Y is the width...I need to divide the rectangle into 3 equal parts and then position the coloured circles on it.
I think you could take the following design for your application.
Or if you don't want to take squares as building blocks:
However this could result in a bad geometry if you don't choose epsilon carefully.
I've read many other posts with similar questions but most answers seem to be around it being an "art", which is probably ok for arbitrary images because we don't know exactly which and how many features are going to be learned. But if we already know the features that we want the CNN to learn, can we make educated guesses?
For example, in the game of tic-tac-toe (noughts and crosses), we know that we're looking for straight lines 2 pixels deep and placements where our move ends up taking the center or corner positions (lets ignore any other features for now). So, we can probably count the ideal feature map size as follows -
2 (2 slanted lines) + 1 (1 vertical line) + 1 (1 horizontal line) + 1 (center placement) + 4 (corner placement) = 9 feature maps?
Is my above understanding of feature maps correct?
Note: I'm using tic-tac-toe (noughts and crosses) just as a very simple example for learning CNN programming. My understanding of feature maps (please feel free to correct if wrong) is that they correspond to actual features like lines, curves etc (at least in the first layer).
For example the light source is coming from 1,3,-5 and object is at 4,-2,-1.
Algebraic formula is going to give the answer as 3. [1,3-5].[4,-2,-1]
= 1*4 + 3*-2 + -5*-1 = 3
But what does this 3 means? How do I know if my object is shaded with this number 3? Or is there more to it? I did look around and unable to find anything conclusive. Would be great if someone could give some insight. Thank you.
Judging from answers, pondering if I am understanding my question wrong. I was trying to get my head around the following question:
For a point on a convex surface, with the normal n=(n1,n2,n3)and light
direction l = (l1,l2,l3), determine if the point can be seen by light
source.
Using a dot product between two points makes no sense. Essentially, a dot product gives a measure of how similar two vectors are. When applied to points, the value will be related to the similarity of the direction to the points from the origin, as well as their distance from it. That metric doesn't make much sense, as you found out with that '3'.
To determine the amount of illumination, you want to be using a dot product between the normalized vector of the direction from the surface to the light and the surface normal. The result will be a value from -1 to 1, which you can interpret as an illumination factor for simple gouraud shading. In pseudocode:
illumination = max(0, dot(normalize(lightPosition - positionOnSurface), surfaceNormal))
Determining if a light hits an object is an entirely different problem called occlusion, and not really something you express in as mathematical formula. It's about testing what objects are in the path from the light to your target object.
The dot product can tell you on what side of a line a point is. The triangle is formed by three lines. If you are on the same side of all three lines then you are inside the triangle. You can use three dot products to test for each of the three sides. See slide 23 on this link http://comp575.web.unc.edu/files/2010/09/06raytracing1.pdf.
I have written a program that arranges stars stars into polyhedra, for example tetrahedron. here is a mutant tetrahedron, i dont know why the sides dont line up, and how to correct it. please help.
I had to rotate the stars by +/- 90' and it lined up symetrically. i was confused because the points of the triads were touching, and it gave the illusion that only half the sides could be aligned. actually, by rotating all sides equally by +/- 30 or by 90 degrees produced 2 different classes of symmetrical shapes.
You have 12 shapes:
which you can make each out of five identical squares.
You need to combine the 12 pieces to one rectangle.
You can form four different rectangles:
2339 solutions (6x10), 2 solutions (3x20), 368 solutions (4x15), 1010 solutions (5x12).
I need to build the 3X20 rectangle:
My question what is the maximum number of states (i.e., the branching factor) that is possible?
My half way calculation:
The way I see it, there are 4 operations on each shape: turn 90/180/270 degrees and mirroring (turning it upside down).
Then, you have to put the shape on the board, somewhere on the 3X20 board.
Illegal states will be one that the shape doesn't fit in the board, but they are still states.
For the first move, you can chose each shape in 4 ways which is 4X12 ways, and then you need to multiply in the number of positions the shape can be in, and that is the number of states you have. But how can I calculate the number of positions?
Please help me with this calculation it is very important, it is not some kind of homework which I'm trying to avoid.
I think there is no easy & 'intelligent' way to list solutions (or states) to pentomino puzzles. You have to try all possibilities. Recursive programming or backtracking is the way to do it. You should check this solution that also has java source code available. Hopefully that points you to the right direction.
There is also a python solution that is perhaps more readable.