How to make the arrow lower??????

Hi Everyone,
I made an arrow using VelocityOrientationProperty. I want the arrow to go lower…let me show you an example which is attached to this discussion…

Originally the arrow which is yellow in color and travel high and down to the destination. But i want the red arrow to travel lower than the yellow… so how to achieve the lower travel…

my code is found below…

var target = viewer.entities.add({

name: (sourceCountry + " - " + destCountry),

position: positions,

orientation: new Cesium.VelocityOrientationProperty(positions),

path: {

resolution: 1,

/*material: new Cesium.PolylineGlowMaterialProperty({

glowPower: 0.1,

color: Cesium.Color.YELLOW

}),*/

//material: new Cesium.PolylineArrowMaterialProperty(Cesium.Color.RED), // by tschia attackArrowColour

material: attackArrowColour(devicetype,alert),

width: 20,

//trailTime: 12460*60,

trailTime: duration, // original is duration

leadTime: 0

},

is there any ways to do that??? what to modify??? please help me thank you

cheers,

abdullah

Hi Everyone,
I made an arrow using VelocityOrientationProperty. I want the arrow to go lower…let me show you an example which is attached to this discussion…

Originally the arrow which is yellow in color and travel high and down to the destination. But i want the red arrow to travel lower than the yellow… so how to achieve the lower travel…

my code is found below…

var target = viewer.entities.add({

name: (sourceCountry + " - " + destCountry),

position: positions,

orientation: new Cesium.VelocityOrientationProperty(positions),

path: {

resolution: 1,

/*material: new Cesium.PolylineGlowMaterialProperty({

glowPower: 0.1,

color: Cesium.Color.YELLOW

}),*/

//material: new Cesium.PolylineArrowMaterialProperty(Cesium.Color.RED), // by tschia attackArrowColour

material: attackArrowColour(devicetype,alert),

width: 20,

//trailTime: 12460*60,

trailTime: duration, // original is duration

leadTime: 0

},

is there any ways to do that??? what to modify??? please help me thank you

cheers,

abdullah

Hi Abdullah,

I think in order to get the path you want, you going to need to modify the positions on the path or the interpolation between them, see the interpolation sandcastle example.

Thanks,

Gabby

Hi Gabby,

thank for the reply…

How does the interpolation help me to lower the curve???
I tried changing the interpolation and it does not work…

I will show the code which contains the starting point and the end point which the arrow travels from point to point…

I tried modifying the mid.point height and it does not change…it does not work in 2D screen…

var startPoint = Cesium.Cartographic.fromDegrees(sourceLongitude, sourceLatitude);

var finalPoint = Cesium.Cartographic.fromDegrees(destLongitude, destLatitude);

// Calculate the midPoint to form the arc out of the earth surface

//Initializes a geodesic on the ellipsoid connecting the two provided planetodetic points.

var geodesic = new Cesium.EllipsoidGeodesic(startPoint, finalPoint);

var midPoint = geodesic.interpolateUsingFraction(0.1, new Cesium.Cartographic());

// Different heights for each attack polyline (1000000 ~ 5000000)

var rand = [Math.floor((Math.random() * 700000) + 500000)];

midPoint.height = rand;

var positions = computePositions(startPoint, midPoint, finalPoint, start, duration);

/*

  • CREATING ENTITIES

*/

/*

  • ENTITY 1:

  • CREATES THE MAIN ATTACK ANIMATION LINE FROM SOURCE TO DESTINATION COUNTRIES

*/

var target = viewer.entities.add({

name: (sourceCountry + " - " + destCountry),

position: positions,

orientation: new Cesium.VelocityOrientationProperty(positions),

path: {

resolution: 1,

/*material: new Cesium.PolylineGlowMaterialProperty({

glowPower: 0.1,

color: Cesium.Color.YELLOW

}),*/

//material: new Cesium.PolylineArrowMaterialProperty(Cesium.Color.RED), // by tschia attackArrowColour

material: attackArrowColour(devicetype,alert),

width: 20,

//trailTime: 12460*60,

trailTime: duration, // original is duration

leadTime: 0

},

description:

});

target.position.setInterpolationOptions({

interpolationDegree: 0.5,

interpolationAlgorithm: Cesium.LagrangePolynomialApproximation

//Cesium.LagrangePolynomialApproximation

});

/*

  • ENTITY 2:

  • CREATES A MARKER ON SOURCE COUNTRIES

*/

var sourceColour =setIntIPSourceColour(sourceIP,devicetype);

//console.log(“TSDebug sourceColour [” + sourceColour+"] for devicetype["+devicetype+"]\n" );

var srcPoint = Cesium.Cartographic.fromDegrees(sourceLongitude, sourceLatitude);

var srcPosition = compSrcDstPosition(srcPoint,srcPoint,start, duration);

var sourcePoint = viewer.entities.add({

name: sourceCountry,

//position : Cesium.Cartesian3.fromDegrees(sourceLongitude, sourceLatitude),

position : srcPosition,

point : {

pixelSize : 10,

/*color : new Cesium.CallbackProperty(

function(time, result){

//return Cesium.Color.fromAlpha(Cesium.Color.BLUE,

return Cesium.Color.fromAlpha(sourceColour,

(new Date(time).getTime() % 1000) / 1000,

result);

}, false),*/

color : sourceColour

//outlineColor: Cesium.Color.BLACK,

//outlineWidth: 2

},

description: '

COUNTRY: ’ + sourceCountry + ‘

’ + '

CITY: ’ + sourceCity +

'

ALERT: '+ alert + ‘

’+ '

Device Type: ’ + devicetype+

Group Id: >’+ groupId +

});

/*

  • ENTITY 3:

  • CREATES A MARKER ON DESTINATION COUNTRIES

*/

//console.log("devicetype at dest "+devicetype);

//console.log("destIP "+destIP + " destCountry "+destCountry );

var destColour = setIntIPSourceColour(destIP,devicetype);

//var destColour = setIntIPSourceColour(dstIP);

var dstPoint = Cesium.Cartographic.fromDegrees(destLongitude, destLatitude);

var dstPosition = compSrcDstPosition(dstPoint,dstPoint,start, duration);

var destPoint = viewer.entities.add({

name: destCountry,

//position : Cesium.Cartesian3.fromDegrees(destLongitude, destLatitude),

position : dstPosition,

point : {

pixelSize : 10,

/*color : new Cesium.CallbackProperty(

function(time, result){

//return Cesium.Color.fromAlpha(Cesium.Color.YELLOW,

return Cesium.Color.fromAlpha(destColour,

(new Date(time).getTime() % 1000) / 1000,

result);

}, true),*/

color : destColour

//outlineColor: Cesium.Color.BLACK,

//outlineWidth: 2

},

description: '

COUNTRY: ’ + destCountry + ‘

’ + '

CITY: ’ + destCity +

'

ALERT: '+ alert + ‘

’+ '

Device Type: ’ + devicetype+

});

viewer.trackEntity = target;

} // end of for loop

;

}); // end of parsing json data

/*

  • FUNCTION TO HELP CREATE THE MAIN ATTACK ANIMATION LINE

*/

function computePositions(startPoint, midPoint, finalPoint, start, duration){

var property = new Cesium.SampledPositionProperty();

var startPosition = viewer.scene.globe.ellipsoid.cartographicToCartesian(startPoint);

property.addSample(start, startPosition);

var midTime = Cesium.JulianDate.addSeconds(start, duration/2, new Cesium.JulianDate());

var midPosition = viewer.scene.globe.ellipsoid.cartographicToCartesian(midPoint);

property.addSample(midTime, midPosition);

var endTime = Cesium.JulianDate.addSeconds(start, duration, new Cesium.JulianDate());

var endPosition = viewer.scene.globe.ellipsoid.cartographicToCartesian(finalPoint);

property.addSample(endTime,endPosition);

return property;

};

This thread seems to be tackling a similar problem: https://groups.google.com/forum/#!topic/cesium-dev/vr_ZH1yRNoQ , try looking at some of the answers there. I hope that helps.