I am trying to find the points which lie within the Sector A of the ARC. I am using D3 to draw the arc on the svg and in a circle where points are plotted. When I move the arc with their start angle or End Angle, the points confined to the ARC changes some property says color or opacity.
What I am doing is, I am calculating the angle (P_A) of the all the points (X, Y) from the center(CX,CY) and trying to check that points lies between the angle of the ARC hands i.e startAngle S_A and end Angle E_A. This is the formula I am using
P_A = atan(Y-CY,X-CX)*180.0/PI;
then I am doing the check:
if (P_A < E_A && P_A > S_A)
{
/// SAY Color of Points are changing.
}
Code I have used to genrate the ARC in D3 is given below
var startAng = 20;
var arcWidth = 1.5;
var vis = Space.append("svg")
var pi = Math.PI;
var arc = d3.svg.arc()
.innerRadius(0)
.outerRadius(radiusC)
.startAngle(S_A* (pi/180)) //converting from degs to radians
.endAngle(E_A) //just radians
vis.attr("width", "400").attr("height", "400") // Added height and width so arc is visible
.append("path")
.attr("d", arc)
.attr("fill", "white")
.style("stroke","black")
.style("opacity",0.2)
.attr("transform", "translate(200,200)");
But it is not working properly.. Nothing is happening as such.