Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
zeroScalarData.push(0.0);
zeroDisplacementData.push(0.0);
zeroDisplacementData.push(0.0);
zeroDisplacementData.push(0.0);
radialHeightData.push(height);
radialSlopeData.push(slope);
radialDisplacementData.push(0.0);
radialDisplacementData.push(0.0);
radialDisplacementData.push(height);
}
// Static Channels.
auxChannels.push(new AuxChannel([new AuxChannelData(0.0, radialDisplacementData)], AuxChannelDataType.Vector, "Static Radial Displacement", "Radial: Static"));
auxChannels.push(new AuxChannel([new AuxChannelData(1.0, radialHeightData)], AuxChannelDataType.Distance, "Static Radial Height", "Radial: Static"));
auxChannels.push(new AuxChannel([new AuxChannelData(1.0, radialSlopeData)], AuxChannelDataType.Scalar, "Static Radial Slope", "Radial: Static"));
// Animated Channels.
const radialDisplacementDataVector = [new AuxChannelData(0.0, zeroDisplacementData), new AuxChannelData(1.0, radialDisplacementData), new AuxChannelData(2.0, zeroDisplacementData)];
const radialHeightDataVector = [new AuxChannelData(0.0, zeroScalarData), new AuxChannelData(1.0, radialHeightData), new AuxChannelData(2.0, zeroScalarData)];
const radialSlopeDataVector = [new AuxChannelData(0.0, zeroScalarData), new AuxChannelData(1.0, radialSlopeData), new AuxChannelData(2.0, zeroScalarData)];
auxChannels.push(new AuxChannel(radialDisplacementDataVector, AuxChannelDataType.Vector, "Animated Radial Displacement", "Radial: Time"));
auxChannels.push(new AuxChannel(radialHeightDataVector, AuxChannelDataType.Distance, "Animated Radial Height", "Radial: Time"));
auxChannels.push(new AuxChannel(radialSlopeDataVector, AuxChannelDataType.Scalar, "Animated Radial Slope", "Radial: Time"));
/** Create linear waves -- 10 separate frames. */
const waveHeight = radius / 20.0;
const waveLength = radius / 2.0;
const frameCount = 10;
const linearDisplacementDataVector = [], linearHeightDataVector = [], linearSlopeDataVector = [];
const slope = Math.abs(Math.cos(angle));
zeroScalarData.push(0.0);
zeroDisplacementData.push(0.0);
zeroDisplacementData.push(0.0);
zeroDisplacementData.push(0.0);
radialHeightData.push(height);
radialSlopeData.push(slope);
radialDisplacementData.push(0.0);
radialDisplacementData.push(0.0);
radialDisplacementData.push(height);
}
// Static Channels.
auxChannels.push(new AuxChannel([new AuxChannelData(0.0, radialDisplacementData)], AuxChannelDataType.Vector, "Static Radial Displacement", "Radial: Static"));
auxChannels.push(new AuxChannel([new AuxChannelData(1.0, radialHeightData)], AuxChannelDataType.Distance, "Static Radial Height", "Radial: Static"));
auxChannels.push(new AuxChannel([new AuxChannelData(1.0, radialSlopeData)], AuxChannelDataType.Scalar, "Static Radial Slope", "Radial: Static"));
// Animated Channels.
const radialDisplacementDataVector = [new AuxChannelData(0.0, zeroDisplacementData), new AuxChannelData(1.0, radialDisplacementData), new AuxChannelData(2.0, zeroDisplacementData)];
const radialHeightDataVector = [new AuxChannelData(0.0, zeroScalarData), new AuxChannelData(1.0, radialHeightData), new AuxChannelData(2.0, zeroScalarData)];
const radialSlopeDataVector = [new AuxChannelData(0.0, zeroScalarData), new AuxChannelData(1.0, radialSlopeData), new AuxChannelData(2.0, zeroScalarData)];
auxChannels.push(new AuxChannel(radialDisplacementDataVector, AuxChannelDataType.Vector, "Animated Radial Displacement", "Radial: Time"));
auxChannels.push(new AuxChannel(radialHeightDataVector, AuxChannelDataType.Distance, "Animated Radial Height", "Radial: Time"));
auxChannels.push(new AuxChannel(radialSlopeDataVector, AuxChannelDataType.Scalar, "Animated Radial Slope", "Radial: Time"));
/** Create linear waves -- 10 separate frames. */
const waveHeight = radius / 20.0;
const waveLength = radius / 2.0;
const frameCount = 10;
radialDisplacementData.push(height);
}
// Static Channels.
auxChannels.push(new AuxChannel([new AuxChannelData(0.0, radialDisplacementData)], AuxChannelDataType.Vector, "Static Radial Displacement", "Radial: Static"));
auxChannels.push(new AuxChannel([new AuxChannelData(1.0, radialHeightData)], AuxChannelDataType.Distance, "Static Radial Height", "Radial: Static"));
auxChannels.push(new AuxChannel([new AuxChannelData(1.0, radialSlopeData)], AuxChannelDataType.Scalar, "Static Radial Slope", "Radial: Static"));
// Animated Channels.
const radialDisplacementDataVector = [new AuxChannelData(0.0, zeroDisplacementData), new AuxChannelData(1.0, radialDisplacementData), new AuxChannelData(2.0, zeroDisplacementData)];
const radialHeightDataVector = [new AuxChannelData(0.0, zeroScalarData), new AuxChannelData(1.0, radialHeightData), new AuxChannelData(2.0, zeroScalarData)];
const radialSlopeDataVector = [new AuxChannelData(0.0, zeroScalarData), new AuxChannelData(1.0, radialSlopeData), new AuxChannelData(2.0, zeroScalarData)];
auxChannels.push(new AuxChannel(radialDisplacementDataVector, AuxChannelDataType.Vector, "Animated Radial Displacement", "Radial: Time"));
auxChannels.push(new AuxChannel(radialHeightDataVector, AuxChannelDataType.Distance, "Animated Radial Height", "Radial: Time"));
auxChannels.push(new AuxChannel(radialSlopeDataVector, AuxChannelDataType.Scalar, "Animated Radial Slope", "Radial: Time"));
/** Create linear waves -- 10 separate frames. */
const waveHeight = radius / 20.0;
const waveLength = radius / 2.0;
const frameCount = 10;
const linearDisplacementDataVector = [], linearHeightDataVector = [], linearSlopeDataVector = [];
for (let i = 0; i < frameCount; i++) {
const fraction = i / (frameCount - 1);
const waveCenter = waveLength * fraction;
const linearHeightData = [], linearSlopeData = [], linearDisplacementData = [];
for (let j = 0; j < polyface.data.point.length; j++) {
const point = polyface.data.point.getPoint3dAtUncheckedPointIndex(j);
const theta = Angle.pi2Radians * (point.x - waveCenter) / waveLength;
const height = waveHeight * Math.sin(theta);
radialDisplacementData.push(0.0);
radialDisplacementData.push(0.0);
radialDisplacementData.push(height);
}
// Static Channels.
auxChannels.push(new AuxChannel([new AuxChannelData(0.0, radialDisplacementData)], AuxChannelDataType.Vector, "Static Radial Displacement", "Radial: Static"));
auxChannels.push(new AuxChannel([new AuxChannelData(1.0, radialHeightData)], AuxChannelDataType.Distance, "Static Radial Height", "Radial: Static"));
auxChannels.push(new AuxChannel([new AuxChannelData(1.0, radialSlopeData)], AuxChannelDataType.Scalar, "Static Radial Slope", "Radial: Static"));
// Animated Channels.
const radialDisplacementDataVector = [new AuxChannelData(0.0, zeroDisplacementData), new AuxChannelData(1.0, radialDisplacementData), new AuxChannelData(2.0, zeroDisplacementData)];
const radialHeightDataVector = [new AuxChannelData(0.0, zeroScalarData), new AuxChannelData(1.0, radialHeightData), new AuxChannelData(2.0, zeroScalarData)];
const radialSlopeDataVector = [new AuxChannelData(0.0, zeroScalarData), new AuxChannelData(1.0, radialSlopeData), new AuxChannelData(2.0, zeroScalarData)];
auxChannels.push(new AuxChannel(radialDisplacementDataVector, AuxChannelDataType.Vector, "Animated Radial Displacement", "Radial: Time"));
auxChannels.push(new AuxChannel(radialHeightDataVector, AuxChannelDataType.Distance, "Animated Radial Height", "Radial: Time"));
auxChannels.push(new AuxChannel(radialSlopeDataVector, AuxChannelDataType.Scalar, "Animated Radial Slope", "Radial: Time"));
/** Create linear waves -- 10 separate frames. */
const waveHeight = radius / 20.0;
const waveLength = radius / 2.0;
const frameCount = 10;
const linearDisplacementDataVector = [], linearHeightDataVector = [], linearSlopeDataVector = [];
for (let i = 0; i < frameCount; i++) {
const fraction = i / (frameCount - 1);
const waveCenter = waveLength * fraction;
const linearHeightData = [], linearSlopeData = [], linearDisplacementData = [];
for (let j = 0; j < polyface.data.point.length; j++) {
const point = polyface.data.point.getPoint3dAtUncheckedPointIndex(j);
zeroScalarData.push(0.0);
zeroDisplacementData.push(0.0);
zeroDisplacementData.push(0.0);
zeroDisplacementData.push(0.0);
radialHeightData.push(height);
radialSlopeData.push(slope);
radialDisplacementData.push(0.0);
radialDisplacementData.push(0.0);
radialDisplacementData.push(height);
}
// Static Channels.
auxChannels.push(new AuxChannel([new AuxChannelData(0.0, radialDisplacementData)], AuxChannelDataType.Vector, "Static Radial Displacement", "Radial: Static"));
auxChannels.push(new AuxChannel([new AuxChannelData(1.0, radialHeightData)], AuxChannelDataType.Distance, "Static Radial Height", "Radial: Static"));
auxChannels.push(new AuxChannel([new AuxChannelData(1.0, radialSlopeData)], AuxChannelDataType.Scalar, "Static Radial Slope", "Radial: Static"));
// Animated Channels.
const radialDisplacementDataVector = [new AuxChannelData(0.0, zeroDisplacementData), new AuxChannelData(1.0, radialDisplacementData), new AuxChannelData(2.0, zeroDisplacementData)];
const radialHeightDataVector = [new AuxChannelData(0.0, zeroScalarData), new AuxChannelData(1.0, radialHeightData), new AuxChannelData(2.0, zeroScalarData)];
const radialSlopeDataVector = [new AuxChannelData(0.0, zeroScalarData), new AuxChannelData(1.0, radialSlopeData), new AuxChannelData(2.0, zeroScalarData)];
auxChannels.push(new AuxChannel(radialDisplacementDataVector, AuxChannelDataType.Vector, "Animated Radial Displacement", "Radial: Time"));
auxChannels.push(new AuxChannel(radialHeightDataVector, AuxChannelDataType.Distance, "Animated Radial Height", "Radial: Time"));
auxChannels.push(new AuxChannel(radialSlopeDataVector, AuxChannelDataType.Scalar, "Animated Radial Slope", "Radial: Time"));
/** Create linear waves -- 10 separate frames. */
const waveHeight = radius / 20.0;
const waveLength = radius / 2.0;
const frameCount = 10;
const linearDisplacementDataVector = [], linearHeightDataVector = [], linearSlopeDataVector = [];
const height = waveHeight * Math.sin(theta);
const slope = Math.abs(Math.cos(theta));
linearHeightData.push(height);
linearSlopeData.push(slope);
linearDisplacementData.push(0.0);
linearDisplacementData.push(0.0);
linearDisplacementData.push(height);
}
linearDisplacementDataVector.push(new AuxChannelData(i, linearDisplacementData));
linearHeightDataVector.push(new AuxChannelData(i, linearHeightData));
linearSlopeDataVector.push(new AuxChannelData(i, linearSlopeData));
}
auxChannels.push(new AuxChannel(linearDisplacementDataVector, AuxChannelDataType.Vector, "Linear Displacement", "Linear: Time"));
auxChannels.push(new AuxChannel(linearHeightDataVector, AuxChannelDataType.Distance, "Linear Height", "Linear: Time"));
auxChannels.push(new AuxChannel(linearSlopeDataVector, AuxChannelDataType.Scalar, "Linear Slope", "Linear: Time"));
polyface.data.auxData = new PolyfaceAuxData(auxChannels, polyface.data.pointIndex);
return polyface;
}
/** Demonstrate the creation of models with analytical data. */
const theta = Angle.pi2Radians * (point.x - waveCenter) / waveLength;
const height = waveHeight * Math.sin(theta);
const slope = Math.abs(Math.cos(theta));
linearHeightData.push(height);
linearSlopeData.push(slope);
linearDisplacementData.push(0.0);
linearDisplacementData.push(0.0);
linearDisplacementData.push(height);
}
linearDisplacementDataVector.push(new AuxChannelData(i, linearDisplacementData));
linearHeightDataVector.push(new AuxChannelData(i, linearHeightData));
linearSlopeDataVector.push(new AuxChannelData(i, linearSlopeData));
}
auxChannels.push(new AuxChannel(linearDisplacementDataVector, AuxChannelDataType.Vector, "Linear Displacement", "Linear: Time"));
auxChannels.push(new AuxChannel(linearHeightDataVector, AuxChannelDataType.Distance, "Linear Height", "Linear: Time"));
auxChannels.push(new AuxChannel(linearSlopeDataVector, AuxChannelDataType.Scalar, "Linear Slope", "Linear: Time"));
polyface.data.auxData = new PolyfaceAuxData(auxChannels, polyface.data.pointIndex);
return polyface;
}
/** Demonstrate the creation of models with analytical data. */
const point = polyface.data.point.getPoint3dAtUncheckedPointIndex(j);
const theta = Angle.pi2Radians * (point.x - waveCenter) / waveLength;
const height = waveHeight * Math.sin(theta);
const slope = Math.abs(Math.cos(theta));
linearHeightData.push(height);
linearSlopeData.push(slope);
linearDisplacementData.push(0.0);
linearDisplacementData.push(0.0);
linearDisplacementData.push(height);
}
linearDisplacementDataVector.push(new AuxChannelData(i, linearDisplacementData));
linearHeightDataVector.push(new AuxChannelData(i, linearHeightData));
linearSlopeDataVector.push(new AuxChannelData(i, linearSlopeData));
}
auxChannels.push(new AuxChannel(linearDisplacementDataVector, AuxChannelDataType.Vector, "Linear Displacement", "Linear: Time"));
auxChannels.push(new AuxChannel(linearHeightDataVector, AuxChannelDataType.Distance, "Linear Height", "Linear: Time"));
auxChannels.push(new AuxChannel(linearSlopeDataVector, AuxChannelDataType.Scalar, "Linear Slope", "Linear: Time"));
polyface.data.auxData = new PolyfaceAuxData(auxChannels, polyface.data.pointIndex);
return polyface;
}
/** Demonstrate the creation of models with analytical data. */