'Algorithms to find shapes among random points

Let's assume we have: A) a large set of random 2D points, and B) a small set of 2D points representing a simple geometric shape of choice, e.g. a triangle (3 x 2D points). I want to perform search over the A set of random points and find sub-sets in A similar to the shape of B.

I wander if there are smart ways or known methods to approach this problem beyond brute force. What would be thoughts, recipes, links, suggestions?

EDIT: added schematics hoping to explain better. Random points are open-circles (the set A in the explanation above). For example, that random mess of points potentially has 3 adjacent points with their configuration very close to a triangle, or 4 adjacent points to a square. In brute force approach I imagine I would do random translation and rotation of a set B (a triangle, or a square, or any other configuration of points in the set B) and estimate sum of residuals. If the residual close to zero or below certain threshold we can claim a shape is a triangle, square, etc. But what could be a smart approach ?

Example:

Thanks, Art



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source