I am loading some PCD data using the PCDLoader, after loading the PCD data successfully we get the Points to add to the scene.
I have a circle on top of the PCD points that I created using the Three.js Line Geometry,
I am trying to reduce the opacity for all the points that lie outside of the Circle.
Here's my code which loads the PCD and draws a circle
this.loader = this.loader || new PCDLoader();
this.loader.load(pcdPath, (mesh: Points) => {
mesh.name = `pcd-mesh`;
(mesh.material as PointsMaterial).size = 1.5;
(mesh.material as PointsMaterial).color.setHex(0xffffff);
const circlePoints = [];
const radius = 18;
for (let i = 0; i <= 360; i++) {
circlePoints.push(
new Vector3(
Math.sin(i * (Math.PI / 180)) * radius,
Math.cos(i * (Math.PI / 180)) * radius,
0
)
);
}
const circleLineGeo = new BufferGeometry().setFromPoints(circlePoints);
const CircleLineMaterial = new LineBasicMaterial({
color: 0xffff00,
linewidth: 1.75,
});
const c = new Line(circleLineGeo, CircleLineMaterial);
this.scene.add(c);
this.renderView();
});
I know I can change the opacity of all the points using the ;(mesh.material as PointsMaterial).opacity = 0.5
but I don't want to change the opacity for all the points, I just want to change the opacity for all the points that Lie outside this yellow circle.