From 3be76dcdb49061cab76eaa391ad8508516da7075 Mon Sep 17 00:00:00 2001 From: Dario Sassi Date: Mon, 11 Jan 2016 14:36:08 +0000 Subject: [PATCH] Include : - aggiornamenti - nuovo header per gestore movimenti di regioni senza collisioni. --- EGkSimpleCDSurfFrMove.h | 69 +++++++++++++++++++++++++++++++++++++++++ EGkSurfFlatRegion.h | 4 --- EInAPI.h | 2 ++ EXeExecutor.h | 2 ++ 4 files changed, 73 insertions(+), 4 deletions(-) create mode 100644 EGkSimpleCDSurfFrMove.h diff --git a/EGkSimpleCDSurfFrMove.h b/EGkSimpleCDSurfFrMove.h new file mode 100644 index 0000000..1e77937 --- /dev/null +++ b/EGkSimpleCDSurfFrMove.h @@ -0,0 +1,69 @@ +//---------------------------------------------------------------------------- +// EgalTech 2015-2016 +//---------------------------------------------------------------------------- +// File : EGkSimpleCDSurfFrMove.h Data : 10.01.16 Versione : 1.6l7 +// Contenuto : Dichiarazione classe per movimento di superfici flat region +// nel loro piano con semplice verifica di collisione +// (ovvero controllando solo gli esterni). +// +// Modifiche : 23.09.15 DS Creazione modulo. +// +// +//---------------------------------------------------------------------------- + +#pragma once + +#include "/EgtDev/Include/EGkSurfFlatRegion.h" + +//----------------------- Macro per import/export ---------------------------- +#undef EGK_EXPORT +#if defined( I_AM_EGK) // da definirsi solo nella DLL + #define EGK_EXPORT __declspec( dllexport) +#else + #define EGK_EXPORT __declspec( dllimport) +#endif + +//---------------------------------------------------------------------------- +// Costanti per info su tipo di Semplice Collisione tra regioni piane +const int SCI_NONE = 0 ; // non definito +const int SCI_PNT_PNT = 1 ; // tra punto di mobile e punto di fissa +const int SCI_PNT_LINE = 2 ; // tra punto di mobile e linea di fissa +const int SCI_LINE_PNT = 3 ; // tra linea di mobile e punto di fissa +const int SCI_LINE_LINE = 4 ; // tra linea di mobile e linea di fissa + +//---------------------------------------------------------------------------- +struct SCollInfo +{ + int nType ; + int nIdM ; + int nChunkM ; + int nCrvM ; + int nIdF ; + int nChunkF ; + int nCrvF ; + Point3d ptP1 ; // punto di contatto + Point3d ptP2 ; // se contatto linea-linea, secondo punto di contatto + Vector3d vtDirM ; // se contatto del mobile con linea, sua direzione + Vector3d vtDirF ; // se contatto del fisso con linea, sua direzione + // costruttore + SCollInfo() : nType( SCI_NONE), nIdM( GDB_ID_NULL), nChunkM( -1), nCrvM( -1), + nIdF( GDB_ID_NULL), nChunkF( -1), nCrvF( -1), ptP1(), ptP2(), vtDirM(), vtDirF() {} +} ; + +//---------------------------------------------------------------------------- +class SimpleCDSurfFrMove +{ + public : + EGK_EXPORT SimpleCDSurfFrMove( const ISurfFlatRegion& SfrM, const ISurfFlatRegion& SfrF) ; + + public : + EGK_EXPORT bool Translate( const Vector3d& vtDir, double& dLen) ; + EGK_EXPORT bool Rotate( const Point3d& ptCen, double& dAng) ; + EGK_EXPORT const SCollInfo& GetSCollInfo() + { return m_SCollInfo ;} + + private : + const ISurfFlatRegion* m_pRegM ; + const ISurfFlatRegion* m_pRegF ; + SCollInfo m_SCollInfo ; +} ; \ No newline at end of file diff --git a/EGkSurfFlatRegion.h b/EGkSurfFlatRegion.h index c9087af..191e437 100644 --- a/EGkSurfFlatRegion.h +++ b/EGkSurfFlatRegion.h @@ -41,10 +41,6 @@ class __declspec( novtable) ISurfFlatRegion : public ISurf virtual bool GetChunkCentroid( int nChunk, Point3d& ptCen) const ; virtual bool GetCurveClassification( const ICurve& Crv, CRVCVECTOR& ccClass) const = 0 ; virtual int GetChunkSimpleClassification( int nChunk, const ISurfFlatRegion& Other, int nOthChunk) const ; // compare only outsides - virtual bool TranslateSimpleNoCollision( const ISurfFlatRegion& Other, const Vector3d& vtDir, - double& dLen) const = 0 ; // verify only outsides - virtual bool RotateSimpleNoCollision( const ISurfFlatRegion& Other, const Point3d& ptCen, - double& dAng) const = 0 ; // verify only outsides } ; //----------------------------------------------------------------------------- diff --git a/EInAPI.h b/EInAPI.h index 40b4653..61d590c 100644 --- a/EInAPI.h +++ b/EInAPI.h @@ -465,6 +465,8 @@ EIN_EXPORT BOOL __stdcall EgtPackPartCluster( int nId[], int nCount, BOOL bReduc double dXmin, double dYmin, double dXmax, double dYmax, BOOL bBottomUp) ; EIN_EXPORT BOOL __stdcall EgtMovePartCluster( int nId[], int nCount, BOOL bReducedCut, double vtMove[3], double dXmin, double dYmin, double dXmax, double dYmax) ; +EIN_EXPORT BOOL __stdcall EgtGetObstacleTangent( double vtTang[3]) ; +EIN_EXPORT BOOL __stdcall EgtGetMovingTangent( double vtTang[3]) ; EIN_EXPORT BOOL __stdcall EgtRotatePartCluster( int nId[], int nCount, BOOL bReducedCut, const double ptCen[3], double* pdRotAngDeg, double dXmin, double dYmin, double dXmax, double dYmax) ; EIN_EXPORT BOOL __stdcall EgtGetPartClusterCenterGlob( int nId[], int nCount, double ptCen[3]) ; diff --git a/EXeExecutor.h b/EXeExecutor.h index 935c500..304a46e 100644 --- a/EXeExecutor.h +++ b/EXeExecutor.h @@ -494,6 +494,8 @@ EXE_EXPORT bool ExePackPartCluster( const INTVECTOR& vIds, bool bReducedCut, double dXmin, double dYmin, double dXmax, double dYmax, bool bBottomUp) ; EXE_EXPORT bool ExeMovePartCluster( const INTVECTOR& vIds, bool bReducedCut, Vector3d& vtMove, double dXmin, double dYmin, double dXmax, double dYmax) ; +EXE_EXPORT bool ExeGetObstacleTangent( Vector3d& vtTang) ; +EXE_EXPORT bool ExeGetMovingTangent( Vector3d& vtTang) ; EXE_EXPORT bool ExeRotatePartCluster( const INTVECTOR& vIds, bool bReducedCut, const Point3d& ptCen, double& dRotAngDeg, double dXmin, double dYmin, double dXmax, double dYmax) ; EXE_EXPORT bool ExeGetPartClusterCenterGlob( const INTVECTOR& vIds, Point3d& ptCen) ;