feat: 点云数据修改

main
JINGYJ 2 weeks ago
parent 663bbeb2a6
commit 6256295c81

@ -103,6 +103,11 @@ const activeIndex = ref(-1);
const swiperRef = ref(null);
const isPointOpen = ref<Boolean>(false); //
const columns = [
{
label: "站点",
property: "is_reviewed",
width: 60,
},
{
label: "车号",
property: "train_number",
@ -133,16 +138,16 @@ const columns = [
property: "level",
width: 60,
},
{
label: "复核",
property: "is_reviewed",
formatter: ({ is_reviewed }) => {
return is_reviewed === true
? "是"
: "否";
},
width: 60,
},
// {
// label: "",
// property: "is_reviewed",
// formatter: ({ is_reviewed }) => {
// return is_reviewed === true
// ? ""
// : "";
// },
// width: 60,
// },
{
label: "时间",
property: "created_at",

@ -120,7 +120,7 @@ const onDialogOpened = () => {
// false
loading.value = false;
//
pointCloud.position.set(0, 300, 0);
pointCloud.position.set(0, 100, 0);
//
const geometry = pointCloud.geometry;
@ -131,39 +131,43 @@ const onDialogOpened = () => {
const numPoints = positions.length / 3;
//
const startColor = new THREE.Color(0x00ff00); // 绿
const midColor = new THREE.Color(0xffff00); //
const startColor = new THREE.Color(0x0000ff); //
const midColor1 = new THREE.Color(0x00ff00); // 绿
const midColor2 = new THREE.Color(0xffff00); //
const endColor = new THREE.Color(0xff0000); //
// z
let minZ = Infinity;
let maxZ = -Infinity;
for (let i = 0; i < numPoints; i++) {
const z = positions[i * 3 + 2];
if (z < minZ) minZ = z;
if (z > maxZ) maxZ = z;
}
let maxZ = -Infinity;
for (let i = 0; i < numPoints; i++) {
const z = positions[i * 3 + 2];
if (z < minZ) minZ = z;
if (z > maxZ) maxZ = z;
}
for (let i = 0; i < numPoints; i++) {
const z = positions[i * 3 + 2];
//
const factor = (z - minZ) / (maxZ - minZ);
let color;
if (factor < 0.5) {
// 绿
const subFactor = factor * 2;
color = startColor.clone().lerp(midColor, subFactor);
} else {
//
const subFactor = (factor - 0.5) * 2;
color = midColor.clone().lerp(endColor, subFactor);
}
//
colors.push(color.r, color.g, color.b);
for (let i = 0; i < numPoints; i++) {
const z = positions[i * 3 + 2];
//
const factor = (z - minZ) / (maxZ - minZ);
let color;
if (factor < 0.33) {
// 绿
const subFactor = factor / 0.33;
color = startColor.clone().lerp(midColor1, subFactor);
} else if (factor < 0.66) {
// 绿
const subFactor = (factor - 0.33) / 0.33;
color = midColor1.clone().lerp(midColor2, subFactor);
} else {
//
const subFactor = (factor - 0.66) / 0.34;
color = midColor2.clone().lerp(endColor, subFactor);
}
//
colors.push(color.r, color.g, color.b);
}
//
const colorAttribute = new THREE.Float32BufferAttribute(colors, 3);
geometry.setAttribute('color', colorAttribute);

Loading…
Cancel
Save