Short answer yes, if you like scripting and trigonometry (maybe even a little calculus) you can achieve something with the xpAPITextureShader.
Long answer: Below is a very experimental script that is attempting to accomplish that. If I'm being honest it's been so long since I did this I can't remember where my head was at when I was doing it. It's lacking any/all functionality beyond just drawing a hardcoded pentagon to a specific set of coordinates. By the time I got to this point we no longer had a need to explore this so I abandoned it where it is now.
From where I left off, the next steps (and probably the hardest) would be:
- Convert user inputted datasets to work within your constraints so they would fit within your bounds
- Draw a line from your polygon's origin point (which isn't 0,0 because Xpression scene's 0,0 is in the lower left so it has to be offset)
- Take the x,y of those end points and storing them into an array (pointslist)
- Connecting those points with the DrawPolygon and FillPolygon functions
And then there's probably stuff I'm missing, again it's been awhile.
Engine.DebugMessage("Start",0)
'===================================
' Material Declarations
'===================================
dim Mat as xpMaterial
dim APITexture as xpAPITextureShader
dim Pen as xpPen
Engine.GetMaterialByName("PentMat", Mat)
Mat.GetShaderByName("APIPent", APITexture)
APITexture.Clear
Pen = Engine.CreatePen
Pen.Size = 5
Pen.SetColor(0, 0, 255, 255)
'===================================
' Coordinate Centering / Guide Ellipse Drawing
'===================================
dim CircleSize as Integer = 500
dim CircleRad as Integer = CircleSize/2
dim CirclePosX as Integer = 960 - CircleRad
dim CirclePosY as Integer = 540 - CircleRad
APITexture.DrawEllipse(Pen,CirclePosX,CirclePosY,CircleSize,CircleSize)
APITexture.DrawEllipse(Pen,960-CircleRad/2,540-CircleRad/2,CircleRad,CircleRad)
'===================================
' Pentagon Centering and Drawing
'===================================
Pen.SetColor(255,125,0,255)
APITexture.DrawLine(Pen,960,540,960,540+CircleRad)
APITexture.DrawLine(Pen,960,540,1200,610)
APITexture.DrawLine(Pen,960,540,1125,353)
APITexture.DrawLine(Pen,960,540,795,353)
APITexture.DrawLine(Pen,960,540,720,610)
dim PentCoords as xpPointList
PentCoords = Engine.CreatePointList
dim Con as Double = 180/Math.Pi
dim FillBrush as xpBaseBrush
Engine.CreateBrush(0,FillBrush)
FillBrush.SetColor(250,150,150,135)
Pen.SetColor(255,150,150,255)
'===================================
' HardCoded Points
'===================================
PentCoords.AddPoint(960,540+CircleSize/2) 'p1
PentCoords.AddPoint(1200,610) 'p2
PentCoords.AddPoint(1125,353) 'p3
PentCoords.AddPoint(795,353) 'p4
PentCoords.AddPoint(720,610) 'p5
'===================================
' Procedural Points
'===================================
APITexture.DrawPolygon(Pen,PentCoords)
APITexture.FillPolygon(FillBrush,PentCoords)
Engine.DebugMessage("Convert = " & Math.Cos(18),0)
Engine.DebugMessage("Cosine Result Needs to Equal ~1200 = " & 960 + CircleRad*(Math.Cos(18)/Con),0)
Engine.DebugMessage("Sine = " & 540+(250*Math.Abs(Math.Sin(18))),0)
Engine.DebugMessage("Complete",0)
#XPression