AGI AgRadarPlugin 11 Send comments on this topic.
Compute Method (IAgStkRadarClutterGeometryPlugin)
See Also  Example
computeParams





Description

Clutter geometry plugin compute.

Syntax

[Visual Basic .NET]
Public Sub Compute( _
   ByVal computeParams As IAgStkRadarClutterGeometryComputeParams _
) 

[Managed C++]
public: void Compute(
IAgStkRadarClutterGeometryComputeParams ^ computeParams
);

[Unmanaged C++]
public: HRESULT Compute(
IAgStkRadarClutterGeometryComputeParams * computeParams
);

Parameters

computeParams

Remarks

The Compute method is responsible for generating the collection of clutter patches for the current time step.  It does this by calling the Add method on the IAgStkClutterPatchCollection interface returned by the ClutterPathes method of the computeParams input parameter.  The Add method constructs a new IAgStkRadarClutterPatch object, adds it to the collection, and then returns it to the caller.  The plugin should then set the new patches location and area.  The Compute method should add as many patches to the collection as required using the radar link data provided by the IAgStkRadarLink interface returned by the RadarLink property as well as the transmitted signal data provided by the IAgCRSignal interface returned by the Signal property both on the computeParams input parameter.  (NOTE:  The IAgCRSignal interface returned by the Signal property of the computeParams input parameter can be cast to the IAgStkRadarSignal interface to obtain radar signal specific data such as pulse repetition frequency, etc.)

Example

C# Copy Code
public void Compute(IAgStkRadarClutterGeometryComputeParams computeParams) 

    IAgStkRadarLink radarLink = computeParams.RadarLink; 
    IAgStkRadarLinkGeometry radarLinkGeom = radarLink.Geometry; 
    IAgStkRadarPosVelProvider xmtRdrPosVel = radarLinkGeom.TransmitRadarPosVelProvider; 
 
    CartVec xmtRdrPosCBF = new CartVec(xmtRdrPosVel.PositionCBFArray); 
 
    m_cbIntersectComputeParams.SetBasePositionCBF(xmtRdrPosCBF.X, xmtRdrPosCBF.Y, xmtRdrPosCBF.Z); 
 
    double sinOffset = Math.Sin(m_halfPi - OffsetAngle); 
    double cosOffset = Math.Cos(m_halfPi - OffsetAngle); 
 
    //==============================  First Point Start ====================================================== 
    CartVec pt1Cbf = new CartVec(xmtRdrPosVel.ConvertBodyCartesianToCBFCartesianArray(cosOffset, 0.0, sinOffset)); 
    m_cbIntersectComputeParams.SetDirectionCBF(pt1Cbf.X, pt1Cbf.Y, pt1Cbf.Z); 
 
    IAgStkRadarCBIntersectComputeResult pIntersectResult1 = xmtRdrPosVel.ComputeCentralBodyIntersect(m_cbIntersectComputeParams); 
    if (pIntersectResult1.IntersectionFound) 
    { 
        IAgStkRadarClutterPatch clutterPatch = computeParams.ClutterPatches.Add(); 
 
        CartVec intersectPt = new CartVec(pIntersectResult1.Intercept1CBFArray); 
        clutterPatch.SetPositionCBF(intersectPt.X, intersectPt.Y, intersectPt.Z); 
        clutterPatch.Area = PatchArea; 
    } 
    //==============================  Second Point Start ====================================================== 
    CartVec pt2Cbf = new CartVec(xmtRdrPosVel.ConvertBodyCartesianToCBFCartesianArray(-cosOffset, 0.0, sinOffset)); 
    m_cbIntersectComputeParams.SetDirectionCBF(pt2Cbf.X, pt2Cbf.Y, pt2Cbf.Z); 
 
    IAgStkRadarCBIntersectComputeResult pIntersectResult2 = xmtRdrPosVel.ComputeCentralBodyIntersect(m_cbIntersectComputeParams); 
    if (pIntersectResult2.IntersectionFound) 
    { 
        IAgStkRadarClutterPatch clutterPatch = computeParams.ClutterPatches.Add(); 
 
        CartVec intersectPt = new CartVec(pIntersectResult2.Intercept1CBFArray); 
        clutterPatch.SetPositionCBF(intersectPt.X, intersectPt.Y, intersectPt.Z); 
        clutterPatch.Area = PatchArea; 
    } 
    //==============================  Third Point Start ====================================================== 
    CartVec pt3Cbf = new CartVec(xmtRdrPosVel.ConvertBodyCartesianToCBFCartesianArray(0.0, cosOffset, sinOffset)); 
    m_cbIntersectComputeParams.SetDirectionCBF(pt3Cbf.X, pt3Cbf.Y, pt3Cbf.Z); 
 
    IAgStkRadarCBIntersectComputeResult pIntersectResult3 = xmtRdrPosVel.ComputeCentralBodyIntersect(m_cbIntersectComputeParams); 
    if (pIntersectResult3.IntersectionFound) 
    { 
        IAgStkRadarClutterPatch clutterPatch = computeParams.ClutterPatches.Add(); 
 
        CartVec intersectPt = new CartVec(pIntersectResult3.Intercept1CBFArray); 
        clutterPatch.SetPositionCBF(intersectPt.X, intersectPt.Y, intersectPt.Z); 
        clutterPatch.Area = PatchArea; 
    } 
    //==============================  Fourth Point Start ====================================================== 
    CartVec pt4Cbf = new CartVec(xmtRdrPosVel.ConvertBodyCartesianToCBFCartesianArray(0.0, -cosOffset, sinOffset)); 
    m_cbIntersectComputeParams.SetDirectionCBF(pt4Cbf.X, pt4Cbf.Y, pt4Cbf.Z); 
 
    IAgStkRadarCBIntersectComputeResult pIntersectResult4 = xmtRdrPosVel.ComputeCentralBodyIntersect(m_cbIntersectComputeParams); 
    if (pIntersectResult4.IntersectionFound) 
    { 
        IAgStkRadarClutterPatch clutterPatch = computeParams.ClutterPatches.Add(); 
 
        CartVec intersectPt = new CartVec(pIntersectResult4.Intercept1CBFArray); 
        clutterPatch.SetPositionCBF(intersectPt.X, intersectPt.Y, intersectPt.Z); 
        clutterPatch.Area = PatchArea; 
    } 
}
C++ Copy Code
STDMETHODIMP CExample1::Compute(IAgStkRadarClutterGeometryComputeParams* computeParams) 

    EX_BEGIN_PARAMS() 
        EX_IN_INTERFACE_PARAM(computeParams) 
    EX_END_PARAMS() 
 
    HRESULT hr = S_OK; 
 
    Try 
    { 
        CComPtr pRadarLink; 
        EXCEPTION_HR(computeParams->get_RadarLink(&pRadarLink)); 
 
        CComPtr pRadarLinkGeom; 
        EXCEPTION_HR(pRadarLink->get_Geometry(&pRadarLinkGeom)); 
 
        CComPtr pXmtRdrPosVel; 
        EXCEPTION_HR(pRadarLinkGeom->get_TransmitRadarPosVelProvider(&pXmtRdrPosVel)); 
 
        CartVec xmtRdrPosCBF; 
        EXCEPTION_HR(pXmtRdrPosVel->GetPositionCBF(&xmtRdrPosCBF.x, &xmtRdrPosCBF.y, &xmtRdrPosCBF.z)); 
 
        EXCEPTION_HR(m_pCbIntersectComputeParams->SetBasePositionCBF(xmtRdrPosCBF.x, xmtRdrPosCBF.y, xmtRdrPosCBF.z)); 
 
        CComPtr pPatchCollection; 
        EXCEPTION_HR(computeParams->get_ClutterPatches(&pPatchCollection)); 
 
       VARIANT_BOOL intersectFound; 
       Double sinOffset = sin(AgCHALFPI - m_offsetAngle); 
       Double cosOffset = cos(AgCHALFPI - m_offsetAngle); 
 
       //==============================  First Point Start ====================================================== 
       CartVec pt1Cbf; 
       EXCEPTION_HR(pXmtRdrPosVel->ConvertBodyCartesianToCBFCartesian(cosOffset, 0.0, sinOffset, &pt1Cbf.x, &pt1Cbf.y, &pt1Cbf.z)); 
       EXCEPTION_HR(m_pCbIntersectComputeParams->SetDirectionCBF(pt1Cbf.x, pt1Cbf.y, pt1Cbf.z)); 
 
       CComPtr pIntersectResult1; 
       EXCEPTION_HR(pXmtRdrPosVel->ComputeCentralBodyIntersect(m_pCbIntersectComputeParams, &pIntersectResult1)); 
       EXCEPTION_HR(pIntersectResult1->get_IntersectionFound(&intersectFound)); 
       If(intersectFound == VARIANT_TRUE) 
       { 
           CComPtr pClutterPatch; 
           EXCEPTION_HR(pPatchCollection->Add(&pClutterPatch)); 
 
           CartVec intersectPt; 
           EXCEPTION_HR(pIntersectResult1->GetIntercept1CBF(&intersectPt.x, &intersectPt.y, &intersectPt.z)); 
           EXCEPTION_HR(pClutterPatch->SetPositionCBF(intersectPt.x, intersectPt.y, intersectPt.z)); 
           EXCEPTION_HR(pClutterPatch->put_Area(m_patchArea)); 
       } 
       //==============================  Second Point Start ====================================================== 
       CartVec pt2Cbf; 
       EXCEPTION_HR(pXmtRdrPosVel->ConvertBodyCartesianToCBFCartesian(-cosOffset, 0.0, sinOffset, &pt2Cbf.x, &pt2Cbf.y, &pt2Cbf.z)); 
       EXCEPTION_HR(m_pCbIntersectComputeParams->SetDirectionCBF(pt2Cbf.x, pt2Cbf.y, pt2Cbf.z)); 
 
       CComPtr pIntersectResult2; 
       EXCEPTION_HR(pXmtRdrPosVel->ComputeCentralBodyIntersect(m_pCbIntersectComputeParams, &pIntersectResult2)); 
       EXCEPTION_HR(pIntersectResult2->get_IntersectionFound(&intersectFound)); 
       If(intersectFound == VARIANT_TRUE) 
       { 
           CComPtr pClutterPatch; 
           EXCEPTION_HR(pPatchCollection->Add(&pClutterPatch)); 
 
           CartVec intersectPt; 
           EXCEPTION_HR(pIntersectResult2->GetIntercept1CBF(&intersectPt.x, &intersectPt.y, &intersectPt.z)); 
           EXCEPTION_HR(pClutterPatch->SetPositionCBF(intersectPt.x, intersectPt.y, intersectPt.z)); 
           EXCEPTION_HR(pClutterPatch->put_Area(m_patchArea)); 
       } 
       //==============================  Third Point Start ====================================================== 
       CartVec pt3Cbf; 
       EXCEPTION_HR(pXmtRdrPosVel->ConvertBodyCartesianToCBFCartesian(0.0, cosOffset, sinOffset, &pt3Cbf.x, &pt3Cbf.y, &pt3Cbf.z)); 
       EXCEPTION_HR(m_pCbIntersectComputeParams->SetDirectionCBF(pt3Cbf.x, pt3Cbf.y, pt3Cbf.z)); 
 
       CComPtr pIntersectResult3; 
       EXCEPTION_HR(pXmtRdrPosVel->ComputeCentralBodyIntersect(m_pCbIntersectComputeParams, &pIntersectResult3)); 
       EXCEPTION_HR(pIntersectResult3->get_IntersectionFound(&intersectFound)); 
       If(intersectFound == VARIANT_TRUE) 
       { 
           CComPtr pClutterPatch; 
           EXCEPTION_HR(pPatchCollection->Add(&pClutterPatch)); 
 
           CartVec intersectPt; 
           EXCEPTION_HR(pIntersectResult3->GetIntercept1CBF(&intersectPt.x, &intersectPt.y, &intersectPt.z)); 
           EXCEPTION_HR(pClutterPatch->SetPositionCBF(intersectPt.x, intersectPt.y, intersectPt.z)); 
           EXCEPTION_HR(pClutterPatch->put_Area(m_patchArea)); 
       } 
       //==============================  Fourth Point Start ====================================================== 
       CartVec pt4Cbf; 
       EXCEPTION_HR(pXmtRdrPosVel->ConvertBodyCartesianToCBFCartesian(0.0, -cosOffset, sinOffset, &pt4Cbf.x, &pt4Cbf.y, &pt4Cbf.z)); 
       EXCEPTION_HR(m_pCbIntersectComputeParams->SetDirectionCBF(pt4Cbf.x, pt4Cbf.y, pt4Cbf.z)); 
 
       CComPtr pIntersectResult4; 
       EXCEPTION_HR(pXmtRdrPosVel->ComputeCentralBodyIntersect(m_pCbIntersectComputeParams, &pIntersectResult4)); 
       EXCEPTION_HR(pIntersectResult4->get_IntersectionFound(&intersectFound)); 
       If(intersectFound == VARIANT_TRUE) 
       { 
           CComPtr pClutterPatch; 
           EXCEPTION_HR(pPatchCollection->Add(&pClutterPatch)); 
 
           CartVec intersectPt; 
           EXCEPTION_HR(pIntersectResult4->GetIntercept1CBF(&intersectPt.x, &intersectPt.y, &intersectPt.z)); 
           EXCEPTION_HR(pClutterPatch->SetPositionCBF(intersectPt.x, intersectPt.y, intersectPt.z)); 
           EXCEPTION_HR(pClutterPatch->put_Area(m_patchArea)); 
       } 
    } 
    Catch( HRESULT r ) 
    { 
        hr = r; 
    } 
    Catch(...) 
    { 
        hr = E_FAIL; 
    } 
 
    Return hr; 
}

See Also

© 2016 Analytical Graphics, Inc. All Rights Reserved.

STK Programming Interface 11.0.1